Advice needed concerning Win32 signals - Mailing list pgsql-hackers

From Thomas Hallgren
Subject Advice needed concerning Win32 signals
Date
Msg-id 43527068.5000107@home.se
Whole thread Raw
List pgsql-hackers
Hi,
I'm in the process of securing the PL/Java signal handling routines. 
Since a multi-threaded JVM is running and a signal can occur at any time 
in any thread, I need to trap some of them and make sure that they are 
executed in the main thread. Using Posix signals, this is easy. Here's a 
sample handler:

static void pljavaStatementCancelHandler(int signum)
{   if(pthread_self() == mainThread)      /*       * Call original handler       */
StatementCancelHandler(signum);  else      /*       * Dispatch to main thread.       */       pthread_kill(mainThread,
signum);/* Send it to main thread */
 
}

The mainThread was initialized when the handler was first registered.
From looking at the PostgreSQL signal handling routines for Win32, I 
realize that several threads are involved already. Perhaps all signals 
are indeed dispatched to the main thread already? I couldn't really 
figure it out. I need help from someone who knows more about this.

Regards,
Thomas Hallgren



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Question about Ctrl-C and less
Next
From: Greg Stark
Date:
Subject: Re: slow IN() clause for many cases