Advice needed concerning Win32 signals

From: Thomas Hallgren <thomas(dot)hallgren(at)home(dot)se>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Advice needed concerning Win32 signals
Date: 2005-10-16 15:23:20
Message-ID: 43527068.5000107@home.se
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2005-10-16 15:50:09 Re: [HACKERS] roundoff problem in time datatype
Previous Message Martijn van Oosterhout 2005-10-16 13:25:49 Question about Ctrl-C and less