in reply to Re^3: Problems using module Async
in thread Problems using module Async

Awww. I just encountered another problem with that. Since these threads are threads and not forks, there are no PIDs, I could use to identify the thread (I would have used that PIDs in the above named shared hash with thread state etc.). Is there some ID for threads? I know I could use the object itself as key in the hash since I can retrieve it in child via threads->self(). But it if should be something, that is not recycled so fast. I mean if the thread is finished I need to depend on no new thread by coincidence gets the same "ID" before the parent gets a chance to check the hash for the status and returns. This should never take longer than lets say worst case a few seconds (more likely ms) so PIDs where a nice ID for that job.

Replies are listed 'Best First'.
Re^5: Problems using module Async
by BrowserUk (Patriarch) on Nov 29, 2015 at 18:10 UTC
    Is there some ID for threads?

    Yes. It called the thread id: my $thread = threads->create(... ); my $tid = $thread->tid;

    That said, thread handles are also unique, so you could also use that as a key in your hash.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
    In the absence of evidence, opinion is indistinguishable from prejudice.