Re: Undefined thread object for main thread (tid zero) even though the main thread exists
[email protected] (Mike Pomraning) Mon, 3 Dec 2012 08:47:08 -0600
| Newsgroups | perl.ithreads |
|---|---|
| Message-ID | <CAPZFfA-hxoROJMysd8PDC2qQjdFfbahHo8x0BYBWZHt_JPEwHw@mail.gmail.com> |
--f46d043be1f424fa4804cff3d4d5 Content-Type: text/plain; charset=ISO-8859-1 On Sun, Dec 2, 2012 at 10:53 PM, David Mertens <[email protected]>wrote: > ----%<---- > > defined (threads->object($originating_tid{$name})) > or croak("retrieve_pdls: '$name' was created in a thread that " > . "is no longer available"); > > ---->%---- > > In my test suite, I create and store data in the main thread. For this > example, then, $originating_tid{$name} == 0 for all cases considered. The > problem is that only the main thread is capable of retrieving the threads > object for tid 0. Any other (child) thread gets an undefined value. Does > that surprise anyone? Are child threads able to get the thread objects for > their parents or siblings? > I might be misreading this, but I believe that threads->object() ignores detached threads unless a tid is explicitly passed in *and* that tid is the tid of the calling thread. The main thread is detached, so no thread other than tid 0 can look it up via object(). (You describe an interesting problem and approach; do you have demonstration code that others can take a look at?) -Mike --f46d043be1f424fa4804cff3d4d5--