thread-safety

LoadLibrary Static/Globals and Threads

Say I have a DLL that has the following static/global: ClassA Object; Along with the implementation of ClassA, it also contains a 'regular' ClassB, which will not work properly if ClassA has not been constructed yet (which is why I've made ClassA is a static/global). In Windows, I believe that the DLL loader will load this DLL on the...

waveOut (Win32API) and multithreading

Hi I cannot find any information about the thread-safety of the waveOut API. After i creating new waveOut handle, i have those threads: Thread 1: Buffers handling. Uses those API functions: waveOutPrepareHeader waveOutWrite waveOutUnprepareHeader Thread 2: Gui, Controller thread. Uses those API functions: waveOutPause waveOutRes...

INotifyPropertyChanged with threads

I have a BindingList<T> which is bound to a datagridview. One property in my class takes long to calculate, so I threaded the action. After the calculation I raise the OnPropertyChanged() event to notify the grid that the value is ready. At least, that's the theory. But since the OnPropertyChanged Method is called from a differend ...

Building a worker thread pool for a non-thread-safe code

What's the best way to wrap non-thread-safe code in the .net framework? I've got a third-party library that isn't thread safe due to its use of static variables. Rewriting it isn't an option. This library is used by an asp.net web service that receives lots of simultaneous calls. I've currently got it wrapped in a proxy class that uses...

Is SoapHttpClientProtocol thread safe?

Hi, I created a Web Service proxy with the "add web reference" feature of VS 2008 (c#). The generated class derives from SoapHttpClientProtocol Can I store only one instance of my proxy in a singleton? Is it thread safe? Is there state between calls that would prevent me from doing this? Thanks! ...

thread synchronization - delicate issue

let's i have this loop : static a; for (static int i=0; i<10; i++) { a++; ///// point A } to this loop 2 threads enters... i'm not sure about something.... what will happen in case thread1 gets into POINT A , stay there, while THREAD2 gets into the loop 10 times, but after the 10'th loop after incrementing i's value to 10, befo...

what will happen if not lock the dictionary when i modify it? about asp.net cache

sorry i have many questions about the lock/cache.=_=.. ->1. about cache, i know that the cache in asp.net is threadsafe, the simple code i usually use is IList<User> user= HttpRuntime.Cache["myCacheItem"] as IList<User>; if (user == null) { //should i have a lock here? //lock(some_static_var){...} Htt...

Thread Synchronization and Thread Pausing\Resuming

Hi, I am trying to send the files from local to FTP, for that I am locking the TCPClient before sending the file. And that file sending is doing in another thread. So that the main thread doesn't affected. As when I try to use the locked TCPClient before Unlocking it, it hangs. So how should I proceed, so that at the same time I can sen...

I started a thread in background in a UIview, what happens to the thread after I left the view?

I started a thread in a UIview as a background thread which transfer data for the view. However, crash happens in such situation: When I left the view at the very time that the thread is trying to transfer data. I didn't get quite clear with the relationship between the UIview object and thread. I guess it crashes because the thread was...

Are there any thread-safe graph libraries for C++?

Basically I am looking for a graph library that would have fine-grained locking around graph operations, so that different threads touching different parts of the graph could alter it simultaneously, and competing modifications could be blocked. I googled around a bit and can't find anything. Maybe this is too specific to my needs, but...

If all collection attributes are thread-safe , can we say that this collection is thread-safe ?

If all attributes (or items fields, or data members) of a java collection are thread-safe (CopyOnWriteArraySet,ConcurrentHashMap, BlockingQueue, ...), can we say that this collection is thread-safe ? an exemple : public class AmIThreadSafe { private CopyOnWriteArraySet thradeSafeAttribute; public void add(Object o) { ...

Is sscanf thread-safe on iPhone OS 3.1.2 ?

I was just spending my whole day debugging a random bug when i finally realized the Problem was sscanf being called from multiple threads. I confirmed by running the following code which works as expected on Snow Leopard but produces very strange results on my iphone with os 3.1.2. It also works fine in the Simulator. On the iPhone the...

Are Axis2 generated stubs thread-safe?

Are client stubs generated from WSDL by Axis2 thread-safe? Of course, "thread-safe" isn't necessary a rigorously defined term, so I'm at least interested in the following: Are different instances of the same stub class accessible concurrently by different threads, with the same effective behavior as single-threaded execution? Is a sin...

Using a non-thread-safe component with a multithread component (Design)

Design problem : Using a non-thread-safe component (Collection, API, ...) in/with a multithread component ... Example : component1 : A multithread socket server who send messages ... to a message handler component2 : A non-thread-safe message handler who process messages ... from a server My solution : Adding a thread-safe componen...

Should I care about thread safe of static int (4 bytes) variable in ASP .NET

I have the feeling that I should not care about thread safe accessing / writing to an public static int MyVar = 12; in ASP .NET. I read/write to this variable from various user threads. Let's suppose this variable will store the numbers of clicks on a certain button/link. My theory is that no thread can read/write to this variable ...

C++0x static initializations and thread safety

I know that as of the C++03 standard, function-scope static initializations are not guaranteed to be thread safe: void moo() { static std::string cat("argent"); // not thread safe ... } With the C++0x standard finally providing standard thread support, are function-scope static initializations required to be thread safe? ...

synchronized in java Thread

my program is a client connect to multi server. i save connection object to all server in a static map object: server1 -> connection1, server2 -> connection2, .. public class CacheConnection { private final static Map cacheConnection = new HashMap(); public static void add(String serverName, Socket sock) { synchronize...

Implementing synchronization algorithm in C#

Hi I trying to implement synchronization algorithm in C#, without success. Why isn't the following code thread safe? using System; using System.Threading; namespace SoftwareLockTest { class Program { private static volatile bool _isLocked1 = false; private static volatile bool _isLocked2 = false; priva...

linux sockets and multithreading in C

I want to create a process running under linux that creates multiple threads, each thread writing their own data out to a receiving process over a UDP socket connection. For sizing, say I need to have up to one hundred of these threads all running simultaneously with threads coming and going. Is it better to have each thread open up it'...

threadsafe single-consumer, single-producer FIFO on embedded system

I have a TI DSP (TMS320F28235 if anyone cares) that I need to implement a FIFO for queueing information between main-loop code and an interrupt. High-speed execution for this queue is very critical but so is proper operation, and I'm not sure whether I can get away with implementing a FIFO without any explicit synchronization, or if not,...