crash while declaring Image in a second thread
Posted: 2011-01-31T08:29:21-07:00
Hello,
thank you in advance for your help...
my code seems to work fine when i run it through the main thread. But now i want to open my image in a thread different than the main one and when i am trying to declare Image it crashes!
here is the track line from the debugger...
just above there is a comment saying
// To abstract locking primatives across all thread policies, use:
// __exchange_and_add_dispatch
// __atomic_add_dispatch
i am not sure if it is related to my problem, but if it is how do you use that, or what can be done to solve the issue.
I tried to lock the mutex when declaring image but does not seem to work
Thanks again
thank you in advance for your help...
my code seems to work fine when i run it through the main thread. But now i want to open my image in a thread different than the main one and when i am trying to declare Image it crashes!
here is the track line from the debugger...
Code: Select all
my declaration on
Image magickImage;
that calls
// Default constructor
Magick::Image::Image( void )
: _imgRef(new ImageRef)
{
}
that calls
Magick::ImageRef::ImageRef ( void )
: _image(0),
_options(new Options),
_id(-1),
_refCount(1),
_mutexLock()
{
// Allocate default image
_image = AcquireImage( _options->imageInfo() );
that calls
image->cache=AcquirePixelCache(0);
that calls
if (number_threads == 0)
cache_info->number_threads=GetOpenMPMaximumThreads();
that calls
gomp_resolve_num_threads
that calls in atomicity.h
#ifdef _GLIBCXX_ATOMIC_BUILTINS
static inline _Atomic_word
__exchange_and_add(volatile _Atomic_word* __mem, int __val)
{ return __sync_fetch_and_add(__mem, __val); }
where it crashes
// To abstract locking primatives across all thread policies, use:
// __exchange_and_add_dispatch
// __atomic_add_dispatch
i am not sure if it is related to my problem, but if it is how do you use that, or what can be done to solve the issue.
I tried to lock the mutex when declaring image but does not seem to work
Thanks again