Commit Graph

15 Commits

Author SHA1 Message Date
michael
a14117e0bb * Merging revisions r45805 from trunk:
------------------------------------------------------------------------
    r45805 | michael | 2020-07-19 00:35:36 +0200 (Sun, 19 Jul 2020) | 1 line
    
    * Add TerminatedSet (delphi compatibility, bug ID #37388)
    ------------------------------------------------------------------------

git-svn-id: branches/fixes_3_2@46598 -
2020-08-23 09:24:13 +00:00
michael
65c880a7f6 * Use STACK_SIZE_PARAM_IS_A_RESERVATION for stack sizes, should fix bug ID #17755
git-svn-id: trunk@33346 -
2016-03-27 11:12:47 +00:00
svenbarth
bd7cc36ea6 The documentation says that a "BeginThread" needs to be followed by a "CloseThread". The implementation of TThread did not respect this yet.
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 -
2013-04-23 20:13:07 +00:00
svenbarth
764f36a179 Extend TThread with (class) methods and (class) properties from Delphi 2007 and newer.
Especially for the introduction of the Queue method the internal Synchronize handling was modified. Instead of handling only one event there is now a queue of events which is walked completely when CheckSynchronize is called. Each entry in the queue can carry a PRTLEvent which will be signaled when the contained method has been executed and thus Synchronize methods can still be blocking.
Exceptions inside the queued methods are either handed back to the calling method for Synchronize events or raised directly (after leaving the queue in a valid state) to the caller of CheckSynchronize.

The way platform specific adjustments can be made to TThread was changed. Instead of implementing the Constructor and Destructor directly one now implements the methods SysCreate and SysDestroy which are called from the Constructor and Destructor respectively. All RTLs were adjusted for this and should be controlled by the platform maintainers for correct compilation (Unix works).

The new method NameThreadForDebugging has two overloaded variants: one with the thread name as AnsiString and one with the thread name as UnicodeString.
By default the AnsiString variant calls the UnicodeString variant and the latter needs to be implemented. This can be changed by defining THREADNAME_IS_ANSISTRING for a platform. Then the UnicodeString variant calls the AnsiString one and the AnsiString one needs to be implemented.

Also added was a global property CPUCount for the System unit. This property returns the number of virtual cores of the system.

New methods and functions that should be implemented per platform are:
System.GetCPUCount (default returns 1)
Classes.TThread.GetSystemTimes (default zeros the struct)
Classes.TThread.NameThreadForDebugging (default does nothing)

More detailed information about the added methods will be available in the feature announcement mail.

git-svn-id: trunk@23227 -
2012-12-27 16:16:17 +00:00
sergei
2a303c88f5 * On thread creation error, use a resourcestring message and textual representation of system error code.
- Removed an unused type declaration.

git-svn-id: trunk@17164 -
2011-03-22 15:26:28 +00:00
sergei
ffc357a528 * TThread, Windows implementation: prevent resource leak when destroying an initially suspended and never resumed thread. The thread must be always resumed so that ThreadProc can complete and cleanup. Fixes Mantis #17560.
git-svn-id: trunk@16290 -
2010-11-01 22:37:33 +00:00
sergei
a66876704b * Windows platforms: always start a thread in suspended state and resume it later in AfterConstruction if necessary, prevents race conditions in constructor. Fixes Mantis #16884 on Windows.
git-svn-id: trunk@16091 -
2010-10-06 16:57:15 +00:00
florian
88f6b8854e * proper error handling in case of thread creation failure on windows, resolves #13768, no test case due because such a test is too sensitive regarding race conditions etc. and might cause false failures
git-svn-id: trunk@13222 -
2009-06-01 14:17:01 +00:00
marco
82b9749e71 * thread creation failure for win<x>. Mantis 13798
git-svn-id: trunk@13188 -
2009-05-23 15:40:13 +00:00
micha
be06f28b18 - win rtl: remove unused thread window (hint by Sergei Gorelkin)
git-svn-id: trunk@12872 -
2009-03-09 19:10:00 +00:00
Vincent Snijders
acba12517b * fixed compilation on win64 by using LResult as result type of a window proc
git-svn-id: trunk@12779 -
2009-02-23 20:29:08 +00:00
micha
3b171cb6fb * windows rtl: fix resource leak when cleaning up last tthread without message loop (fixes issue #13173)
git-svn-id: trunk@12761 -
2009-02-21 17:42:33 +00:00
yury
ff37ef8786 * fixed i386-wince support. WinCE API functions are cdecl.
git-svn-id: trunk@5741 -
2006-12-29 20:49:03 +00:00
florian
33baacbe04 * fixed leaking of TThread
git-svn-id: trunk@3519 -
2006-05-14 09:15:09 +00:00
florian
4084c4261d + more units for winx64
git-svn-id: trunk@3226 -
2006-04-16 11:37:28 +00:00