I'm in the process of writing a template library for data-caching in C++ where concurrent read can be done and concurrent write too, but not for the same key. The pattern can be explained with the following environment:
A mutex for the cache write.
A mutex for each key in the cache.
This way if a thread requests a key from the cache ...
Hi. I have been struggling with this seeminly easy problem for 48 hours, and I am no closer to a solution. So I was hoping that someone might be able to help me.
I am building a app, that use a combination of a local (SQLite) database and an online database (PHP/MYSQL). The app is nearly finished. Checked for leaks and work like a char...
Hey, I didn't see this anywhere in their FAQ and wanted to know if EDMessage.framework [ http://www.mulle-kybernetik.com/software/EDFrameworks/ ] is thread safe. If it matters, I'd be sending out bulk quantities of html emails. I am currently sending each email one at a time on a non-main thread. Also, from the looks of the info on it...
(Any One There)
I am working on vehicle tracking system:-
I have n number of buses say
b1t1(start at 7 am and stop at 7 pm)
bt2 (start at 8 am and stop at 8 pm) and bt3 (start at 9 am and stop at 9 pm)
,where t is start time of a bus
now i h...
Hi,
Is the ANTLR3 C Target Thread Safe?
Thx
...
my_macro << 1 << "hello world" << blah->getValue() << std::endl;
should expand into:
std::ostringstream oss;
oss << 1 << "hello world" << blah->getValue() << std::endl;
ThreadSafeLogging(oss.str());
Thanks!
EDIT: the accepted answer is awesome. Can we upvote 8 more times and win this responder a badge?
(The answer only needs 6 mor...
Which one synchronization method to use to ensure a singleton remains a singleton?
+(Foo*)sharedInstance
{
@synchronized(self)
{
if (nil == _sharedInstance)
{
_sharedInstance = [[Foo alloc] init];
...
}
}
return _sharedInstance;
}
or using a mutex?
#import <pthread.h>
static pthread_mu...
There question relates to a very specific and common scenario in which a dictionary is being used for on-demand caching of items in a multi-threaded environment. To avoid thread locking it's preferable to test for an existing cache item outside of a sync lock, but if we subsequently have to add an item then that counts as a write to the ...
Hi,
I would like to know if the python built-in container (list, vector, set...) are thread-safe ? Or do I need to implement a locking/unlocking environment for my shared variable.
Thanks in advance
...
I have this question.
public class Foo : object
{
public override bool Equals(obj a, objb)
{
return ((Foo)a).Bar.GetHashCode() == ((Foo)b).Bar.GetHashCode();
}
}
Suppose I want to make Foo threadsafe. Do I need to synchronize calls to GetHashCode()?
...
If I have the following psuedocode:
sharedVariable = somevalue;
CreateThread(threadWhichUsesSharedVariable);
Is it theoretically possible for a multicore CPU to execute code in threadWhichUsesSharedVariable() which reads the value of sharedVariable before the parent thread writes to it? For full theoretical avoidance of even the remote...
I was reading Walkthrough: Creating an Asynchronous HTTP Handler and noticed they pass the HttpContext from the handler thread and use it in a WaitCallback which runs on a background thread. It makes calls like _context.Response.Write(). Am I correct in assuming that this doesn't violate the fact that HttpContext is not thread safe bec...
I have an app (using retain/release, not GC) that maintains an NSArray instance variable, which is exposed as a property like so:
@interface MyObject : NSObject
{
NSArray* myArray;
}
@property (copy) NSArray* myArray;
@end
I want to access the contents of this array from a secondary thread, which is detached using -performSelector...
In our SharePoint/ASP.NET environment we have a series of data retriever classes that all derive from a common interface. I was assigned the task of creating a data retriever that could communicate remotely with other SharePoint farms using WCF. The way I have it implemented at the moment is a singleton ChannelFactory<T> is created in a ...
Is there any point in keeping track of the classic bool disposed field on an otherwise threadsafe type for the purposes of conditionally throwing an ObjectDisposedException at the beginning of all primary exposed methods?
I've seen this pattern recommended in a few places online but I'm not sure if the authors are using it correctly, ...
is it possible to have multiple threads sending on the same socket? will there be interleaving of the streams or will the socket block on the first thread (assuming tcp)? the majority of opinions i've found seems to warn against doing this for obvious fears of interleaving, but i've also found a few comments that state the opposite. are ...
--Summary (shortened)--
I have a controller that loads a profile object from the corresponding DAO. It updates some properties, many of them sets, and then calls saveOrUpdate (via save in the DAO) to reattach and update the profile object. At seemingly random intervals, we get an org.hibernate.exception.ConstraintViolationException, w...
I mean for some basic operations, like reads/writes of class attributes.
Or, maybe, it introduces some higher level synchronization?
...
Dear all,
I am new to JMS API , I want to try QueueSender in multi-thread environment....
So, the question ..
Is QueueSender.send() thread safe ?please provide reference or demo if available
thanks in advance,,,,
...
Given:
class Foo {
Foo() {};
};
class Bar {
static int counter;
Bar() { ++counter; }
}
It's clear that Foo::Foo is thread safe whereas Bar::bar is not.
Furthermore, it's clear that if a function is written in such a way so that it's not thread-safe, then clearly putting it in a constructor makes that constructor not thread saf...