become unmasked.
* sigproc.cc (pending_signals): Flip back to a global.
(wait_sig): Don't set pending signals when there is an armed semaphore or
signal is blocked.
* shared.cc (shared_info::initialize): Add a username parameter for user-mode
mounts. Reorganize to try to avoid startup race.
(memory_init): Move some stuff into shared_info::initialize.
* shared_info.h (shared_info::initialize): Change declaration.
(CURR_SHARED_MAGIC): Update.
+2003-09-03 Christopher Faylor <cgf@redhat.com>
+
+ * exceptions.cc (set_process_mask): Set pending signals only when
+ signals become unmasked.
+ * sigproc.cc (pending_signals): Flip back to a global.
+ (wait_sig): Don't set pending signals when there is an armed semaphore
+ or signal is blocked.
+
+ * shared.cc (shared_info::initialize): Add a username parameter for
+ user-mode mounts. Reorganize to try to avoid startup race.
+ (memory_init): Move some stuff into shared_info::initialize.
+ * shared_info.h (shared_info::initialize): Change declaration.
+ (CURR_SHARED_MAGIC): Update.
+
2003-09-01 Christopher Faylor <cgf@redhat.com>
* include/cygwin/version.h: Bump DLL minor number to 4.
sigproc_printf ("old mask = %x, new mask = %x", myself->getsigmask (), newmask);
myself->setsigmask (newmask); // Set a new mask
mask_sync->release ();
- if (oldmask != newmask)
- sig_dispatch_pending ();
- else
+ if (!(oldmask & ~newmask))
sigproc_printf ("not calling sig_dispatch_pending. sigtid %p current %p",
sigtid, GetCurrentThreadId ());
+ else
+ {
+ extern bool pending_signals;
+ pending_signals = true;
+ sig_dispatch_pending ();
+ }
return;
}
}
void
-shared_info::initialize ()
+shared_info::initialize (const char *user_name)
{
- if (version)
+ DWORD sversion = (DWORD) InterlockedExchange ((LONG *) &version, SHARED_VERSION_MAGIC);
+ if (!sversion)
+ {
+ /* Initialize the queue of deleted files. */
+ delqueue.init ();
+
+ /* Initialize tty table. */
+ tty.init ();
+ }
+ else
{
if (version != SHARED_VERSION_MAGIC)
- multiple_cygwin_problem ("shared", version, SHARED_VERSION_MAGIC);
- else if (cb != SHARED_INFO_CB)
- multiple_cygwin_problem ("shared size", cb, SHARED_INFO_CB);
- return;
+ {
+ multiple_cygwin_problem ("shared", version, SHARED_VERSION_MAGIC);
+ InterlockedExchange ((LONG *) &version, sversion);
+ }
+ while (!cb)
+ low_priority_sleep (0); // Should be hit only very very rarely
+ }
+
+ /* Initialize the Cygwin heap, if necessary */
+ if (!cygheap)
+ {
+ cygheap_init ();
+ cygheap->user.set_name (user_name);
}
- /* Initialize the queue of deleted files. */
- delqueue.init ();
+ heap_init ();
+
+ if (!sversion)
+ cb = sizeof (*this); // Do last, after all shared memory initializion
- /* Initialize tty table. */
- tty.init ();
- version = SHARED_VERSION_MAGIC;
- cb = sizeof (*this);
if (cb != SHARED_INFO_CB)
system_printf ("size of shared memory region changed from %u to %u",
SHARED_INFO_CB, cb);
memory_init ()
{
getpagesize ();
+
+ char user_name[UNLEN + 1];
+ DWORD user_name_len = UNLEN + 1;
+
+ if (!GetUserName (user_name, &user_name_len))
+ strcpy (user_name, "unknown");
+
/* Initialize general shared memory */
HANDLE shared_h = cygheap ? cygheap->shared_h : NULL;
cygwin_shared = (shared_info *) open_shared ("shared",
sizeof (*cygwin_shared),
SH_CYGWIN_SHARED);
- cygwin_shared->initialize ();
-
- /* Allocate memory for the per-user mount table */
- char user_name[UNLEN + 1];
- DWORD user_name_len = UNLEN + 1;
-
- if (!GetUserName (user_name, &user_name_len))
- strcpy (user_name, "unknown");
-
- /* Initialize the Cygwin heap, if necessary */
- if (!cygheap)
- {
- cygheap_init ();
- cygheap->user.set_name (user_name);
- }
+ cygwin_shared->initialize (user_name);
cygheap->shared_h = shared_h;
ProtectHandleINH (cygheap->shared_h);
- heap_init ();
-
+ /* Allocate memory for the per-user mount table */
mount_table = (mount_info *) open_shared (user_name, MOUNT_VERSION,
cygwin_mount_h, sizeof (mount_info),
SH_MOUNT_TABLE);
#define SHARED_INFO_CB 47112
-#define CURR_SHARED_MAGIC 0x359218a2U
+#define CURR_SHARED_MAGIC 0x53f1a7f4U
/* NOTE: Do not make gratuitous changes to the names or organization of the
below class. The layout is checksummed to determine compatibility between
tty_list tty;
delqueue_list delqueue;
- void initialize ();
+ void initialize (const char *);
unsigned heap_chunk_size ();
};
DWORD NO_COPY sigtid = 0; // ID of the signal thread
-static bool NO_COPY pending_signals = false; // true if signals pending
+bool NO_COPY pending_signals = false; // true if signals pending
/* Functions
*/
{
/* If x > 0, we have to deal with a signal at some later point */
if (rc != RC_NOSYNC && x > 0)
- pending_signals = true; // There should be an armed semaphore, in this case
+ /*pending_signals = true*/; // There should be an armed semaphore, in this case
if (sig > 0 && sig != SIGKILL && sig != SIGSTOP &&
(sigismember (&myself->getsigmask (), sig) ||
{
sigproc_printf ("signal %d blocked", sig);
x = InterlockedIncrement (myself->getsigtodo (sig));
- pending_signals = true;
+ /* pending_signals = true;*/ // will be set by set_process_mask
}
else
{
sigproc_printf ("Got signal %d", sig);
if (!sig_handle (sig))
{
+ pending_signals = true;
saw_failed_interrupt = true;
x = InterlockedIncrement (myself->getsigtodo (sig));
- pending_signals = true;
}
}
if (rc == RC_NOSYNC && x > 0)