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.

EntityManager ThreadLocal pattern with JPA in JSE

I'm developing a simple "Book Store" project using Struts 1.3 + JPA (with Hibernate as persistence provider). I cannot switch to Spring …

hibernate thread-safety struts entity jpa-2.0
C#: How can I make an IEnumerable<T> thread safe?

Say I have this simple method: public IEnumerable<uint> GetNumbers() { uint n = 0; while(n < 100) yield return n++; } …

c# thread-safety ienumerable
Thread-safety of writing a std::vector vs plain array

I've read on Stackoverflow that none of the STL containers are thread-safe for writing. But what does that mean in …

c++ stl thread-safety openmp
Why do I need a memory barrier?

C# 4 in a Nutshell (highly recommended btw) uses the following code to demonstrate the concept of MemoryBarrier (assuming A and …

c# multithreading thread-safety shared-memory memory-barriers
Is memcpy process-safe?

Ive looked online and have not been able to satisfy myself with an answer. Is memcpy threadsafe? (in Windows) What …

c++ c process thread-safety memcpy
C# Threading issue with AutoResetEvent

How to properly synchronize this? At the moment it is possible that SetData is called after e.WaitOne() has completed …

c# multithreading locking thread-safety autoresetevent
Why aren't classes like BindingList or ObservableCollection thread-safe?

Time and time again I find myself having to write thread-safe versions of BindingList and ObservableCollection because, when bound to …

c# .net thread-safety observablecollection bindinglist
Synchronize on value, not object

I want to do something like this in Java public void giveMoney(String userId, int money) { synchronized (userId) { Profile p = …

java thread-safety synchronized
Do multiple threads Using the same object in java make a copy of it?

How do multiple threads in Java handle working with a single object reference passed to them? Do they make a …

java multithreading thread-safety thread-synchronization java-threads
Are urllib2 and httplib thread safe?

I'm looking for information on thread safety of urllib2 and httplib. The official documentation (http://docs.python.org/library/urllib2.…

python thread-safety urllib2 httplib