Commit Graph

65 Commits

Author SHA1 Message Date
ondrej
c64429cdd0 * lazy thread initialization support
git-svn-id: trunk@47308 -
2020-11-04 14:55:40 +00:00
michael
213d2905df * Change some methods from using var to using out (bug ID 37376)
git-svn-id: trunk@46533 -
2020-08-21 10:44:48 +00:00
svenbarth
c8b7094378 * fix for Mantis #36940: apply (adjusted) patch by Bi0T1N to add functionality to the thread manager to set a thread's debug name (if supported by the platform)
git-svn-id: trunk@45160 -
2020-04-28 19:58:20 +00:00
florian
72416edcc4 + support for tlsm_general on i386-linux
git-svn-id: trunk@40281 -
2018-11-11 17:32:20 +00:00
marco
8c854cedee * more case fixes, mantis #32832 manually done.
git-svn-id: trunk@38865 -
2018-04-29 14:05:09 +00:00
michael
16ba47be46 * Patch from Ondrej Pokorny to convert unit names to CamelCase (bug ID 33481)
git-svn-id: trunk@38616 -
2018-03-23 22:06:36 +00:00
sergei
67bd4775fd - Cleaned out thread manager semaphore support which was ever implemented only for Unix, and not used since r28965. This also reverts changes to System unit interface introduced in r27665.
git-svn-id: trunk@34542 -
2016-09-20 20:14:36 +00:00
nickysn
12a9664181 * use 16-bit offsets for threadvars on CPUs with 16-bit address space
git-svn-id: trunk@32013 -
2015-10-11 12:16:26 +00:00
sergei
d7c863185f * Added plain calls for semaphore-related functionality, this removes need to maintain a second copy of thread manager in unis/tthread.inc.
git-svn-id: trunk@27665 -
2014-04-26 13:58:35 +00:00
sergei
f2a4d1bbbc - Do not compile generic threadvar code if tf_section_threadvars flag is enabled for target (currently there are no such targets).
git-svn-id: trunk@25736 -
2013-10-10 12:55:30 +00:00
pierre
7f5aa5a441 Avoid some range check errors for msdos target
git-svn-id: trunk@24517 -
2013-05-16 22:06:33 +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
Jonas Maebe
14b1c8a99c * moved fpc_threadvar_relocate_proc from systemh.inc to thread.inc
and gave it the correct type (TRelocateThreadVarHandler)
  * changed parameter type of InitThread also to TRelocateThreadVarHandler

git-svn-id: trunk@23130 -
2012-12-09 22:42:46 +00:00
Jonas Maebe
dfe59e6838 - removed unimplemented/unsupported rtleventsync (mantis #23332)
git-svn-id: trunk@23012 -
2012-11-18 10:23:48 +00:00
marco
8cce3d3f91 * closethread thread manager field/function. Mantis 13160
git-svn-id: trunk@15072 -
2010-03-26 23:31:52 +00:00
marco
c477df5046 * TCriticalSection.Tryenter support (Mantis 15928) + short test/demo
tested on FreeBSD (general Unix) and Windows. Note that Haiku seems 
    to have a native threadmgr rather than the Unix one. Will notify 
    maintainer (Olivier)

git-svn-id: trunk@15026 -
2010-03-21 11:34:05 +00:00
Jonas Maebe
5a88be1030 * set default stack size to 4 MiB instead of to 32 KiB
git-svn-id: trunk@12526 -
2009-01-08 18:08:32 +00:00
micha
7f2a257102 + heap manager now per thread, reduce heap lock contention
+ heap threading test

git-svn-id: trunk@7407 -
2007-05-20 20:58:12 +00:00
daniel
6aad495cbb * Increase type safety: PRTLevent=type pointer;
git-svn-id: trunk@6626 -
2007-02-24 09:53:19 +00:00
micha
702685717f * cleanup of rtlevents, remove startwait due to persistance guarantee
git-svn-id: trunk@5854 -
2007-01-08 19:11:07 +00:00
Jonas Maebe
0c3afc0cf4 + implementation of cSemaphore* and BasicRTLEvent based on
sem_open/sem_close for Darwin (doesn't have sem_init/sem_destroy)
  + implementation of cSemaphore* based on pipes (for potential future
    systems that don't have either sem* routines)
  + test for basicrtlevent
  * fixed datarace whereby a TThread could be started, run and exit before
    TThread.AfterConstructor had been called (Mantis 6693, all platforms)
  * throw EThread exceptions in TThread.create if something during creating
    the tthread goes wrong (*nix)
  * don't crash in TThread.Destroy if the TThread throws an exception before
    it was fully initialised (*nix)
  * changed order of operations in TThread.Destroy so it doesn't perform
    invalid thread operations in some edge cases (*nix)
  * fixed usage of sem_wait/sem_trywait (can be interrupted) in Semaphore
    and RTLEvent implementations
  * fixed erroneous waiting for threads after they had already exited via
    pthread_detach/pthread_exit
  * fixed several memory leaks in case of thread intialisation errors
    (*nix)
  * unified tthread.inc for all Unices

git-svn-id: trunk@5662 -
2006-12-21 18:22:47 +00:00
Almindor
2ee7e64a4a * adds semaphore support to ThreadManager, removes pipe hack from non linux
+ adds SemaphoreInit, SemaphorePost, SemaphoreWait and SemaphoreDestroy to TM

git-svn-id: trunk@4900 -
2006-10-14 11:39:47 +00:00
tom_at_work
367df58016 * stack related things (sizes, calculations, etc.) are now 64 bit on 64 bit platforms
* default stack size is now also 32k for Windows (allows the use of stack checking when using threads)

git-svn-id: trunk@1718 -
2005-11-10 17:06:25 +00:00
florian
370a66a452 * reverted r1651
git-svn-id: trunk@1653 -
2005-11-05 09:54:44 +00:00
florian
a884848684 * ThreadProc needs stdcall or cdecl calling conventions usually
git-svn-id: trunk@1651 -
2005-11-05 00:05:07 +00:00
florian
9e30922547 * fixed previous commit
git-svn-id: trunk@1623 -
2005-11-01 22:13:37 +00:00
florian
7bff61ce29 * patch from Ales Katona to add a stack size parameter to tthread functions
git-svn-id: trunk@1621 -
2005-11-01 22:01:48 +00:00
michael
859bb30daa + Removed HASTHREADVAR SUPPORT_THREADVAR defines
git-svn-id: trunk@295 -
2005-06-09 17:40:29 +00:00
florian
ad3b9b9464 * windows rtl restructuring to share code between win32 and win64
* BeginThread can take a qword on 64 bit targets as stacksize

git-svn-id: trunk@287 -
2005-06-08 19:08:49 +00:00
peter
4ace790492 * remove $Log
git-svn-id: trunk@231 -
2005-06-07 09:47:55 +00:00
Jonas Maebe
7ba46ce6f0 * Darwin TThreadID is a pointer
* BeginThread now returns a TThreadID instead of dword

git-svn-id: trunk@189 -
2005-06-04 09:33:39 +00:00
fpc
790a4fe2d3 * log and id tags removed
git-svn-id: trunk@42 -
2005-05-21 09:42:41 +00:00
fpc
50778076c3 initial import
git-svn-id: trunk@1 -
2005-05-16 18:37:41 +00:00
Tomas Hajny
1723f08a51 * yet another TThreadID fix 2005-04-20 06:32:47 +00:00
florian
c04f0bc856 * fixed more TThreadID stuff 2005-04-14 20:42:14 +00:00
florian
4aa4aeae79 + TThreadID 2005-04-13 20:10:50 +00:00
florian
710dbcef0a + classes.mainthreadid is set now
+ rtleventresetevent
  + rtleventwairfor with timeout
  + checksynchronize with timeout
  * race condition in synchronize fixed
2005-04-09 17:26:08 +00:00
florian
98106e588c * another "transfer to linux"-commit 2005-02-25 22:02:46 +00:00
peter
e417e34496 * truncate log 2005-02-14 17:13:06 +00:00
peter
2fbaae2b91 * threading in system unit
* removed systhrds unit
2005-02-06 11:20:52 +00:00
armin
690e3330d1 * applied patch to compile go32v2 from Tomas (tested by John) 2005-01-21 21:43:12 +00:00
marco
e12796a400 * tthread patch from neli 2004-12-28 14:20:03 +00:00
marco
cb75ebda02 * checksynchronize now in interface win32 uses the default impl.
unix uses systhrds, rest empty implementation.
2004-12-27 15:28:40 +00:00
marco
7377bbf1c9 * 2nd synchronize attempt. cthreads<->systhrds difference was not ok, but
only showed on make install should be fixed now.
2004-12-23 15:08:58 +00:00
marco
0db4315ea9 * rtlevent kraam. Checked (compile): Linux, FreeBSD, Darwin, Windows
Check work: ask Neli.
2004-12-22 21:29:24 +00:00
peter
64cd72bc5a * x86_64 updates 2004-12-12 14:30:27 +00:00
armin
a23c3f4dd9 * added define DISABLE_NO_THREAD_MANAGER to avoid warnings if thread manager is always present 2004-09-19 18:55:30 +00:00
marco
6ae2f1b4dd * wrappers and nothread prototypes for the basic* functions 2004-05-23 20:26:20 +00:00
marco
41153b8fd2 * first try basicevent 2004-05-23 15:30:29 +00:00
florian
b2a6bd9305 * fixed BeginThread on unix 2004-02-22 23:22:49 +00:00