* bsd_mutex.cc (_msleep): Simplify event creation. Revert change from

2004-08-24.  It should be unnecessary now.
	* msg.cc (client_request_msg::serve): Release process critical
	section as early as possible.
	* sem.cc (client_request_sem::serve): Ditto.
	* shm.cc (client_request_shm::serve): Ditto.
	* process.cc: Use hold and release method calls instead of
	EnterCriticalSection/LeaveCriticalSection calls throughout.
	* process.h (_hold): Rename from hold.  Take filename and linenumber
	parameter for logging.  Define matching hold macro.
	(release): Ditto.
This commit is contained in:
Corinna Vinschen
2004-10-04 19:44:05 +00:00
parent 3ea9de7644
commit 1f8b30497d
7 changed files with 43 additions and 17 deletions

View File

@ -180,9 +180,7 @@ _msleep (void *ident, struct mtx *mtx, int priority,
int ret = -1;
char name[64];
msleep_event_name (ident, name);
HANDLE evt = OpenEvent (EVENT_ALL_ACCESS, FALSE, name);
if (!evt)
evt = CreateEvent (NULL, TRUE, FALSE, name);
HANDLE evt = CreateEvent (NULL, TRUE, FALSE, name);
if (!evt)
panic ("CreateEvent in msleep (%s) failed: %E", wmesg);
if (mtx)
@ -201,7 +199,6 @@ _msleep (void *ident, struct mtx *mtx, int priority,
if ((priority & PCATCH)
&& td->client->signal_arrived () != INVALID_HANDLE_VALUE)
obj_cnt = 4;
td->client->release ();
switch (WaitForMultipleObjects (obj_cnt, obj, FALSE, timo ?: INFINITE))
{
case WAIT_OBJECT_0: /* wakeup() has been called. */
@ -233,7 +230,6 @@ _msleep (void *ident, struct mtx *mtx, int priority,
ResetEvent (evt);
#endif
CloseHandle (evt);
td->client->hold ();
set_priority (old_priority);
if (mtx && !(priority & PDROP))
mtx_lock (mtx);