I'm new to C++ and am writing a multi-threaded app whereby different writers will be pushing objects onto a stack and readers pulling them off the stack (or at least pushing the pointer to an object)..
Are there any structures built-into C++ which can handle this without adding locking code etc.? If not, what about the Boost libraries?
...
Soon i'll start working on a parallel version of a mesh refinement algorithm using shared memory.
A professor at the university pointed out that we have to be very careful about thread safety because neither the compiler nor the stl is thread aware.
I searched for this question and the answer depended on the compiler (some try to be so...
Reading msdn documentation for dictionaries it says : "Public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe."
Those this mean that with a dictionary such as this :
static object syncObject = new object();
static Dictionary<string,MyObject> mydictionary= ...
Does anyone know where I can find an implimentation that wraps an STL map and makes it thread safe? When I say thread safe I mean that it offers only serial access to the map, one thread at a time. Optimally, this map should use only STL and or boost constructs.
...
Does anyone know how to pass multiple parameters into a Thread.Start routine?
I thought of extending the class, but the C# Thread class is sealed.
Here is what I think the code would look like:
...
Thread standardTCPServerThread = new Thread(startSocketServerAsThread);
standardServerThread.Start( orchestrator, initializeMembe...
Asking this question with C# tag, but if it is possible, it should be possible in any language.
Is it possible to implement a doubly linked list using Interlocked operations to provide no-wait locking? I would want to insert, add and remove, and clear without waiting.
...
I recently wrote a program that used a simple producer/consumer pattern. It initially had a bug related to improper use of threading.Lock that I eventually fixed. But it made me think whether it's possible to implement producer/consumer pattern in a lockless manner.
Requirements in my case were simple:
One producer thread.
One consume...
Recently, I asked a question, with title as "Is malloc thread safe?", and inside that I asked, "Is malloc re-entrant?"
I was under the impression that all re-entrant are thread-safe.
Is this assumption wrong?
...
Duplicate: What is the most frequent concurrency problem you’ve encountered in Java?
I've been thinking of list of common programming mistakes/pitfalls that causes the code in Java is not thread safe. Here are the common ones that I encountered in the code through the recent years of Java development.
Using non-static fields within ...
I'm asking about the .Net implementation - System.Data.SQLite.
Are there guidelines to using it in a thread-safe manner?
I know SQLite itself can be compiled with or without thread safety - but how was System.Data.SQLite compiled?
...
For a project in school, we are making a multithreaded server in Java 5.0. This project is centered on the concurrence aspect of a server.
We have some threads dedicated to treating the requests. To do so, they have a call to a ServerSocket.accept() to accept new connections. Our choice was to start a bunch of them and let them treat th...
I have a TObjectList that needs to be processed by several threads. Since internally TObjectList inherits from TList and TList implements its internals as an array I wonder:
Is it thread safe to access the array from different threads as long as we access different indexes?
For example, having a TObjectList called myObjectList:
start ...
I need to design a data structure that supports the following operations:
search element in the data structure based on a key that is an interval. For example the value within interval 1-5 may be 3, from 6-11 may be 5 and so on. The intervals are contiguous and there is no overlap between them.
find previous and next interval - this i...
Is there a limit to the number of critical sections I can initialize and use?
My app creates a number of (a couple of thousand) objects that need to be thread-safe. If I have a critical section within each, will that use up too many resources?
I thought that because I need to declare my own CRITICAL_SECTION object, I don't waste kerne...
Hi;
The win32 interlocked functions provide a mecanism for atomic operation on data. They are supposed to be thread-safe and multiprocessor-safe.
What happen if the data is not aligned? the interlocked operations are still atomic?
Ex.: incrementing a integer that is not aligned.
Ty
...
I have a custom CMS in which I use an static XElement as the site map. When updates occur to the map, I am synchronizing the writer threads, but am doing nothing with the readers, just allowing them to grab the XElement when they need it.
In testing, I thought that if I was enumerating the XElement from a reader thread, while I update...
Everyone knows that this is not thread safe:
public StringBuilder Builder
{
get
{
if (_builder != null)
_builder = new StringBuilder();
return _builder;
}
}
What about this?
public StringBuilder Builder
{
get { return _builder ?? (_builder = new StringBuilder()); }
}
...
I have a high-level goal of creating a static utility class that encapsulates the encryption for my .NET application. Inside I'd like to minimize the object creations that aren't necessary.
My question is: what is the thread-safety of the classes which implement symmetric encryption within the .NET Framework? Specifically System.Secur...
In Scala, if I have a simple class as follows:
val calc = actor {
var sum = 0
loop {
react {
case Add(n) =>
sum += n
case RequestSum =>
sender ! sum
}
}
}
Should my field sum be marked @volatile? Whilst the actor is logically single-threaded (i.e. the messages are processed sequentially), the...
Is the implementation below thread-safe? If not what am I missing? Should I have the volatile keywords somewhere? Or a lock somewhere in the OnProcessingCompleted method? If so, where?
public abstract class ProcessBase : IProcess
{
private readonly object completedEventLock = new object();
private event EventHandler<ProcessComp...