Top "Thread-safety" questions

A piece of code is thread-safe if it only manipulates data structures in a way that allows consistent execution of this code by multiple threads.

Initializing ThreadStatic field still causes NullReferenceException

I've written myself a multi-threaded random generator public static class MyRandGen { private static Random GlobalRandom = new Random(); [ThreadStatic] private static …

c# random thread-safety threadstatic
How thread safe is thrift? re: I seem to have requests disrupting one another

edit Apparently what I was hoping to do is outside of the scope of thrift... If I make sure there …

java thread-safety thrift
How to set/get string in Java safely?

I have read Java String class is immutable and thread-safe but I am still confused about whether the reference assignment …

java string thread-safety immutability reentrantlock
Using QWidget::update() from non-GUI thread

Sometimes my application crashes in QWidget::update() that is performing in non-GUI thread. I am developing an application in which …

qt thread-safety libvlc
Unsafe State and Safe State

I have learned a little about Unsafe State and Safe State. Safe State is when there is no chance of …

operating-system thread-safety system unsafe bankers-algorithm
Alternative for synchronized block in java

I use following code for guarantee startTime variable set once only: public class Processor { private Date startTime; public void doProcess() { …

java multithreading synchronization thread-safety thread-synchronization
Is javax.naming.InitialContext ThreadSafe

Currently I am use following code to lookup EJB3 sateless session beans for normal POJO class. (We are in JEE5 …

java thread-safety jndi
iostream thread safety, must cout and cerr be locked separately?

I understand that to avoid output intermixing access to cout and cerr by multiple threads must be synchronized. In a …

c++ thread-safety cout
Are channel/stubs in gRPC thread-safe

When using gRPC from Java, can I cache stubs (clients) and call them in a multi-threaded environment or are the …

java thread-safety grpc
C# - How to pause application until timer is finished?

I have an application that I need to have wait a specific amount of time, but I also need to …

c# timer thread-safety system.timers.timer