[AD] Mini-synchronization API proposal for 4.1.x |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I think this mini-API is long overdue because most ports now use threads. It
could be useful for the users, as well as internally in order to synchronize
parts of the platform-independent code (especially timers).
Here's the proposal:
- fully portable: on platforms that don't support threads (DOS, Unix w/o
pthreads, Darwin), do nothing. In particular, not a replacement for internal
"DOS-style semaphores" (flags that prevent re-entrant interrupts) (1).
- inner-process synchronization only: not required to be visible outside the
process, hence can use the lightest solution on every platform (e.g critical
sections under Windows).
- non recursively lockable: in other words, Pthread-style mutexes, not
WinThread-style mutexes.
- minimal common subset functions: create/destroy, lock/unlock (2).
(1) Allegro callbacks should not be re-entrant on platforms that don't
support threads.
(2) Is there a need for a try_lock() function ? Such a function would be
natively supported by Pthreads and by Windows threads on NT kernels but not
on Win9x kernels. In this latter case, it will have to be implemented by the
Win32-specific code (by using an internal system mutex).
--
Eric Botcazou
ebotcazou@xxxxxxxxxx