Notes:
- Netware had a ThreadSwitch in there, but that is not really required
- some platform were missing the setting of FTerminated to True, thus they'll now do that as well
git-svn-id: trunk@46543 -
* Add ThreadQueueLockCounter variable to
postpone call to DoneCriticlSection to the last thread
that decrements back the counter to zero.
* CommonCleanup:
Protect ThreadQueue emptying within
a Enter/Leave-CriticalSection to avoid access y other
threads at the same time.
git-svn-id: trunk@38626 -
Note: the Sender parameter of WakeMainThread will be Nil for such threads. This is Delphi compatible.
rtl/objpas/classes/classesh.inc, TThread:
+ TThreadQueueEntry: new field ThreadID so that entries with Thread = Nil can be removed
rtl/objpas/classes/classes.inc, TThread:
* InitSynchronizeEvent: setup ThreadID field
* Synchronize: use a local TThreadQueueEntry if no TThread instance was passed in
* Queue: setup ThreadID
* RemoveQueueEvents: also check for ThreadID when trying to find the current thread
git-svn-id: trunk@33863 -
rtl/objpas/classes/classes.inc:
+ new variable ExternalThreadsCleanup to keep track whether ExternalThreads list is currently cleared
* TExternalThread.Create: add the thread instance to the external thread list
* TExetrnalThread.Destroy: remove the thread instance from the external thread list (if not in system cleanup anyway)
* CommonCleanup: set ExternalThreadsCleanup to true so that the threads don't remove themselves from the list anymore
+ added test
git-svn-id: trunk@31028 -
TFPGList<CodePointer> on archs/memory models where CodePointer is different
than Pointer. On archs/memory models where CodePointer = Pointer, TCodePtrList
is simply an alias of TList and the fgl unit isn't pulled in.
* the type of FindGlobalComponentList changed to TCodePtrList and the typecasts
from TFindGlobalComponent (procvar type) to Pointer changed to CodePointer.
This fixes compilation of unit classes in the i8086 medium memory model.
git-svn-id: trunk@25357 -
Note: The only RTL where this could lead to problems is for BeOS with the old threading implementation as this does not use "BeginThread" at all (the newer implementation does).
rtl/objpas/classes/classes.inc, TThread.Destroy:
* call "CloseThread" if the thread handle is valid (mimics the logic of the Windows RTL)
rtl/win/tthread.inc, TThread.SysDestroy:
* remove the call to "CloseHandle"; this is done by "CloseThread" afterwards
git-svn-id: trunk@24313 -
rtl/objpas/classes/classes.inc, TThread.GetCurrentThread:
* instead of checking CurrentThreadVar and reading it again afterwards we read it first into Result and check this value; this way we have one read access in the normal case and one read and one write access in the worst case
git-svn-id: trunk@23706 -