gnustep-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libobjc patch to provide condition locks for win32


From: Tom Koelman
Subject: libobjc patch to provide condition locks for win32
Date: Wed, 12 Feb 2003 16:50:49 +0100
User-agent: Gnus/5.090015 (Oort Gnus v0.15) Emacs/21.2

Hi,

Because the win32 code in libobjc doesn't contain an implementation of
condition lock, GNUstep's NSLock doesn't work at all.

The following patch implements a condition lock.

What it does is (somewhat simplified) the following.

A condition basically consists of a queue of event objects that are
waiting on this condition and a mutex that is there to preserve the
internal consistency of the condition. An event object is a
synchronization object that can be signaled manually. When the
condition gets signaled, it signals the first event object in the
queue and releases it afterwards. When the condition gets broadcast,
it signals itself as many times as it has event objects in it's queue.

For the sake of performance, I decided to make the queue of events a circular
array, rather than a linked list. Disadvantage ofcourse is that
the number of threads that now can wait on a condition is limited,
namely to MAX_EVENTS_TO_SET, which currently, arbitrarily, is set to
2048. If the list of events is full and a thread tries to wait on the
condition, the call fails by returning -1.

Attachment: patchfile.patch
Description: addition of win32 condition lock

Attachment: Changelog.patch
Description: Changelog patch for addition of win32 condition lock

Tom

reply via email to

[Prev in Thread] Current Thread [Next in Thread]