Most voted "thread-safety" questions
A piece of code is thread-safe if it only handles data structures in a way that allows consistent execution of this code across multiple execution segments (threads). A code can be thread-safe, conditionally secure (mutual exclusion required) or not (it can only be used securely by a thread).
Learn more…9 questions
Sort by count of
-
15
votes4
answers805
viewsHow to use Simpledateformat in concurrent environments?
The class SimpleDateFormat is not thread safe. I recently had problems with class instances SimpleDateFormat in static context being used by multiple threads concurrently in a web application.…
-
13
votes1
answer443
viewsIs an immutable Enummap thread safe?
An immutable map built on top of a EnumMap could be used in multi-thread environment or there is some risk of competition problems? public enum MyEnum { VALUE1, VALUE2, VALUE3, VALUE4; } private…
-
4
votes2
answers1328
viewsIs it safe to use List with Parallel.Foreach?
I’m making one by making a style method Crawler which receives a string list, makes a call on a website, inserts the return into another list and returns. My method is working, but it’s too slow, so…
-
4
votes1
answer68
viewsIn Assumptions on Timing - I don’t understand this concept of a book
Cited in the book that a critical region has 4 key points: Progress: Ensures that all threads are entering and leaving the critical region, avoiding deadlocks. Mutually Exclusive: Only one thread…
-
3
votes2
answers153
viewsKeyword for C# equivalent to Java’s "Synchronized"
Problem I am implementing a connection manager that implements the standard Singleton, managing a pool connections with unique keys for each new connection. So I’m having problems with the…
-
3
votes1
answer568
viewsAccess a C# thread-based method object with Winforms
I created a thread to run a process that takes too long and makes the application process stop for a great while private void ExeConsultaClientes() { thread = new Thread(new…
-
2
votes1
answer145
viewsInitialize and change static variable in a thead safe way. Does this code make sense? Intellij IDEA doesn’t think
Hello! I’m looking for a safe way to boot and change a static variable that will be shared by different threads that will be accessing its value. The idea is that, at some point, I will verify that…
-
0
votes1
answer26
viewsUpdate_all Rails with own database field
I need to make a change to all the database columns by replicating the information from another column, for example: Model.update_all("a = b") I would like to create threads and start running, for…
-
0
votes1
answer782
viewsPython asyncio and threading
I’m studying the module asyncio of Python and there is the function run_coroutine_threadsafe which should be executed in a different thread than the event loop. Follow my script: #!usr/bin/python3 #…