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.

Creating a thread-safe temporary file name

When using Tempfile Ruby is creating a file with a thread-safe and inter-process-safe name. I only need a file name …

ruby thread-safety filenames temp
difference between standard's atomic bool and atomic flag

I wasn't aware of the std::atomic variables but was aware about the std::mutex (weird right!) provided by the …

c++ multithreading c++11 thread-safety atomic
PHP: What does pcntl_fork() really do?

PHP's pcntl_fork function is supposed to fork a process just as the standard fork function in C. But I …

php apache thread-safety fork process-control
Java Remove Specific Item From ConcurrentHashMap

Is using the remove() method okay? I've read an article that synchronization hasn't been added to the remove method. How …

java thread-safety java.util.concurrent concurrenthashmap
Creating a singleton ChannelFactory<T> and reusing for client connections

In our SharePoint/ASP.NET environment we have a series of data retriever classes that all derive from a common …

wcf singleton thread-safety channelfactory static-constructor
How to use default value in the builder pattern if that value is not passed and also make thread safe?

I am trying to use Builder Pattern for my class.. Below is my Builder class which I have built by …

java thread-safety immutability builder-pattern
Are C# auto-implemented static properties thread-safe?

I would like to know if C# automatically implemented properties, like public static T Prop { get; set; }, are thread-safe or …

c# static thread-safety properties automatic-properties
Thread Confinement

I am reading Java Concurrency in Practice and kind of confused with the thread confinement concept. The book says that …

java multithreading concurrency thread-safety thread-confinement
Unit test for thread safe-ness?

I've written a class and many unit test, but I did not make it thread safe. Now, I want to …

c# .net unit-testing nunit thread-safety
Is the != check thread safe?

I know that compound operations such as i++ are not thread safe as they involve multiple operations. But is checking …

java multithreading thread-safety atomic race-condition