Fri Jan 07 16:57:08 2011: Request 64575 was acted upon.
Transaction: Correspondence added by j...@activestate.com
       Queue: Win32-Daemon
     Subject: RE: [rt.cpan.org #64575] Start callback not called with 
Strawberry Perl 5.10 / 5.12 
   Broken in: (no value)
    Severity: (no value)
       Owner: Nobody
  Requestors: ha...@strotbek.com
      Status: new
 Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=64575 >


On Fri, 07 Jan 2011, Haiko Strotbek via RT wrote:
>  Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=64575 >
> 
> After some debugging I figgured out that the main thread id won't be set
> when working with callbacks. So a PostMessage() call tries to access a
> non existing thread instead of the main thread and the start message is
> never processed.
> 
> I could fix the problem by adding the following lines at Daemon.xs:1229
> 
>               if( 0 == gMainThreadId )
>               {
>                       gMainThreadId = GetCurrentThreadId();
>               }
> 
> Perhaps you can verify the patch and include it in the next version?

I don't understand how that could make a difference. I find only 2
references to gMainThreadId in the sources:

In the DllMain() function (in Daemon.xs line 952) the variable is initialized:

                        gMainThreadId = GetCurrentThreadId();

This code is executed when the DLL is loaded into the process, before
any other code in the same DLL can run.  Since GetCurrentThreadId()
cannot fail, and thread ids are never 0, I can't see how gMainThreadId
can ever be 0 at a later point in time.

The only other reference to gMainThreadId is a PostThreadMessage()
call, which is not supposed to change the value of the thread id.

So how can gMainThreadId still be 0 inside the StartService() function?

Cheers,
-Jan



Reply via email to