[M3commit] CVS Update: cm3
Jay Krell
jkrell at elego.de
Sat Dec 12 15:13:15 CET 2009
CVSROOT: /usr/cvs
Changes by: jkrell at birch. 09/12/12 15:13:15
Modified files:
cm3/m3-libs/m3core/src/thread/WIN32/: ThreadWin32.i3
ThreadWin32.m3
ThreadWin32C.c
Log message:
restore more like traditional structure where more is done in Modula-3
However still with some interesting differences.
- the giant lock is still gone, alert is still its own event :)
- CONTEXT is still abstracted into C
At least getting the fields; we can consider getting the size
from C and then doing the allocation in Modula-3
(Getting CONTEXT right, and not using C, would threaten a LOT of
duplication for VERY little platform variation; for the most part,
Win32 == Win64 except for SIZE_T, sizeof(void*), ULONG_PTR, DWORD_PTR,
INT_PTR, size_t, ptrdiff_t, which are differences easy to deal
with, AND CONTEXT, which is difficult; there are also differences
a la InterlockedExchange vs. InterlockedExchangePointer)
- restore Self() and FreeSlot to being lockful like pthreads
(now that we never call Self() internally!)
- <* ASSERT BYTESIZE(CRITICAL_SECTION) = sizeof(CRITICAL_SECTION) *>
- the static locks are still allocated in C, as our debugging
support is very inadequate and this helps tremendously
(the assert is still needed for the dynamic locks)
Unification with pthreads is made more difficult here,
but in my opinion the experimenting was a success and we
CAN do such unification.
(In particular, I no longer have "LockRE", no longer
compute if stack grows down, I'm willing to assume it)
Still we are structured like pthreads with ProcessLive, ProcessOther,
and the suspend/resume code could be easily moved to C as well.
- The relatively new function GetStackBounds is still in C
but it could be moved to Modula-3.
- assert in BroadcastHeap that we have the lock, so we can
try not introducing the InterlockedCompareExchange dependency,
for more support across operating system versions
RTOS.i3 vaguely implies this is correct.
Alternatively we can introduce a tiny lock for this.
(Even if this is more dependent on C header cloning,
that cloning can be more like m3core/unix where
we wrap every function and implement all constants as C variables;
we don't absolutely have to invent new interfaces for the Modula-3/C bridging)
More information about the M3commit
mailing list