CVS: winex/server process.c, 1.43, 1.44 process.h, 1.17, 1.18 thread.c, 1.56, 1.57

[email protected] 31 Jul 2007 19:58:54 -0000
Newsgroups gmane.comp.emulators.winex.cvs
Message-ID <[email protected]>
Subject: winex/server process.c,1.43,1.44 process.h,1.17,1.18 thread.c,1.56,1.57Update of /var/lib/cvsd/cvsroot/winex/server
In directory agravaine:/tmp/cvs-serv2195/server

Modified Files:
	process.c process.h thread.c 
Log Message:
Approximate the "breaking" of synchronization objects that is supposed to happen in ExitProcess().



Index: process.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/server/process.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- process.c	31 Jul 2007 19:39:35 -0000	1.43
+++ process.c	31 Jul 2007 19:58:52 -0000	1.44
@@ -231,6 +231,7 @@
     process->token             = create_token( &process->obj );
     process->context_fd_list = NULL;
     process->context_fd_list_size = 0;
+    process->is_shutting_down  = 0;
 
     gettimeofday( &process->start_time, NULL );
     if ((process->next = SERVER_STATIC_VARIABLE( process, first_process )) != NULL) process->next->prev = process;
@@ -922,6 +923,7 @@
     {
         reply->self = (current->process == process);
         kill_process( process, current, req->exit_code );
+        process->is_shutting_down = 1;
         release_object( process );
     }
 }

Index: process.h
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/server/process.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- process.h	30 Mar 2007 18:58:50 -0000	1.17
+++ process.h	31 Jul 2007 19:58:52 -0000	1.18
@@ -77,6 +77,7 @@
 
     struct context_entry* context_fd_list; /* Per process array indexed by context_fd */
     unsigned int context_fd_list_size;
+    int                  is_shutting_down; /* True if we're in the shutdown process */
 };
 
 struct process_snapshot

Index: thread.c
===================================================================
RCS file: /var/lib/cvsd/cvsroot/winex/server/thread.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -d -r1.56 -r1.57
--- thread.c	31 Jul 2007 19:39:35 -0000	1.56
+++ thread.c	31 Jul 2007 19:58:52 -0000	1.57
@@ -700,6 +700,16 @@
     int ret, i;
     struct object *objects[MAXIMUM_WAIT_OBJECTS];
 
+    /* This may be a bit blunter than necessary, but the documentation is
+       inconsistent. MSDN suggests that all object handles are closed, which
+       will give roughly this effect. Raymond Chen of "The Old New Thing"
+       gives a breakdown of ExitProcess() on XP that suggests that mutexes
+       and critical sections are broken, but doesn't mention other objects.
+       This should probably be refined, but for now it seems to be sufficient
+       to resolve the ExitProcess() hangs */
+    if (current->process->is_shutting_down)
+       return;
+
     if ((count < 0) || (count > MAXIMUM_WAIT_OBJECTS))
     {
         set_error( STATUS_INVALID_PARAMETER );