[omniORB] omni_thread join problem - leads to core dump

Bruce Visscher bruce.visscher at gmail.com
Tue Jun 8 18:31:36 BST 2010


Forgot to mention ownership.  Never delete a detached thread.  The
omni_thread class takes care of this for you.  Always delete a managed
thread (after joining of course).  If you think about it, this is the
only design that makes sense.

I usually prefer detached threads.

On Tue, Jun 8, 2010 at 4:55 PM, Bruce Visscher <bruce.visscher at gmail.com> wrote:
> Christoph,
>
> This is pretty easy.
>
>     void start(void);
>     // start() causes a thread created with one of the constructors to
>     // start executing the appropriate function.
> ...
>     void start_undetached(void);
>     // can be used with the above constructor in a derived class to cause
>     // the thread to be undetached.  In this case the thread executes the
>     // run_undetached member function.
> ...
>     void join(void**);
>     // join causes the calling thread to wait for another's completion,
>     // putting the return value in the variable of type void* whose address
>     // is given (unless passed a null pointer). Only undetached threads
>     // may be joined. Storage for the thread will be reclaimed.
>
> so, you tried to join a detached thread.  You can't do that. What you
> basically do with a detached thread is somehow "signal" it to shut down
> then trust that it will.
>
> (Having said that, I really dislike the word "undetached".  I would have
> preferred that they used "detached" vs "managed" or something like that.
> Of course, maybe the terminology came from the POSIX standard...)
>
> HTH,
> Bruce
>
> On Tue, Jun 8, 2010 at 4:37 PM, Christoph Becker
> <tuergeist at googlemail.com> wrote:
>>
>> Hi,
>>
>> I don't know if I'm right or not, but omni thread IMHO is more or less
>> a part of omniorb.
>> So I have the problem that a join() always results in a core dump
>> after throwing an omni_thread_invalid.
>>
>> ...
>> MyT* t = new MyT;
>> t->start();
>>
>> /* won't work
>>  * -> terminate called after throwing an instance of 'omni_thread_invalid'
>>  */
>> int * rv;
>> t->join((void**) &rv); // <- breaks here
>>
>> The complete minimal resides @ http://tinypaste.com/55592
>>
>> Any help is welcome.
>>
>> Cheers,
>>  Christoph
>>
>> _______________________________________________
>> omniORB-list mailing list
>> omniORB-list at omniorb-support.com
>> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
>



More information about the omniORB-list mailing list