You are viewing a plain text version of this content. The canonical link for it is here.
Posted to apache-bugdb@apache.org by Matthew Bellew <ma...@hotmail.com> on 1999/03/09 22:21:47 UTC

os-windows/4027: multithread.c uses WaitForSingleObject, shoud use EnterCriticalSection for unnamed mutexes

>Number:         4027
>Category:       os-windows
>Synopsis:       multithread.c uses WaitForSingleObject, shoud use EnterCriticalSection for unnamed mutexes
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    apache
>State:          open
>Class:          change-request
>Submitter-Id:   apache
>Arrival-Date:   Tue Mar  9 13:30:01 PST 1999
>Last-Modified:
>Originator:     matthew_bellew@hotmail.com
>Organization:
apache
>Release:        1.3.4
>Environment:
Windows NT
>Description:
EnterCriticalSection() is very fast, especially when there the caller does not wait.  This clearly a better choice than the current implementation using WaitForSignleObject().

In addition, you can optionally spin on a CriticalSection.
>How-To-Repeat:

>Fix:
Unfortunately named and unnamed mutexes use the same routines.  The best thing to do would probably be to break out the operations for named mutexes e.g.

    ap_create_mutex() and ap_create_named_mutex()

where the named mutexes use NT Mutexes and unnamed use CriticalSections.

Alternatly you could define mutex to be a tagged union so the mutex routines could operate on both CriticalSections and Mutexes.

I'll probably work on this, so send me mail.
>Audit-Trail:
>Unformatted:
[In order for any reply to be added to the PR database, ]
[you need to include <ap...@Apache.Org> in the Cc line ]
[and leave the subject line UNCHANGED.  This is not done]
[automatically because of the potential for mail loops. ]
[If you do not include this Cc, your reply may be ig-   ]
[nored unless you are responding to an explicit request ]
[from a developer.                                      ]
[Reply only with text; DO NOT SEND ATTACHMENTS!         ]