Commit Graph

62 Commits

Author SHA1 Message Date
Jonas Maebe
2701a0f743 * initialise timespec.tv_sec again for generic BasicEventWaitFor
git-svn-id: trunk@8836 -
2007-10-17 21:14:01 +00:00
micha
5f3e2b10e8 * use sem_timedwait for BasicEventWaitFor if available (linux now)
git-svn-id: trunk@8835 -
2007-10-17 20:49:25 +00:00
micha
5d1a952f2a * fix initial state of basicevent
git-svn-id: trunk@8781 -
2007-10-13 20:25:46 +00:00
Jonas Maebe
123362235b * use initc.fpgetCerrno rather than fpgeterrno to get the errno
results of the sem_* routines (since those always come from libc/
    libpthread)

git-svn-id: trunk@8266 -
2007-08-12 08:29:48 +00:00
Jonas Maebe
4457538435 * explicitly unmask SIGSEGV, SIGILL, SIGBUS and SIGFPE at the start
of a new thread (should fix #9073)

git-svn-id: trunk@8265 -
2007-08-11 20:59:37 +00:00
Jonas Maebe
ce86cedd4d * return wrAbandoned rather than wrError from IntbasiceventWaitFor
in case a sleep is interrupted while the event is being destroyed

git-svn-id: trunk@8260 -
2007-08-11 08:13:36 +00:00
Jonas Maebe
ef801ba3a3 * check once more whether we can lock after we've waited
for the entire timeout in IntbasiceventWaitFor

git-svn-id: trunk@8259 -
2007-08-11 08:07:44 +00:00
Jonas Maebe
494fb81dd8 * fixed semaphore implementation based on file handles (select needs
file descriptor + 1 as first parameter, select can also be EIntr)
  * changed IntbasiceventWaitFor (used by syncobjs) so it can emulate
    timeouts (using a loop and short sleeps) (mantis #9414)
  * also added wrAbandoned support to IntbasiceventWaitFor
  * enhanced tbrtlevt.pp to test new functionality

git-svn-id: trunk@8257 -
2007-08-10 20:20:44 +00:00
Jonas Maebe
fd98a0cc5b * don't call runerror if a unix threading error occurs (because this
immediately terminates the whole application), but instead call
    handleerrorframe (which can be converted into an exception) (#7954)

git-svn-id: trunk@8248 -
2007-08-08 13:59:17 +00:00
Jonas Maebe
4dd3be0e5a * return thread function result via pthread_exit() from CBeginThread
(Vinzent Hoefler)
  * simplified CWaitForThreadTerminate based on comments from Vinzent
    Hoefler
  * fixed resource leaks where in some cases a pthread would not be
    reaped based on comments from Vinzent Hoefler (resolves #9016)

git-svn-id: trunk@7588 -
2007-06-06 15:18:48 +00:00
Jonas Maebe
526a79a3c6 * disable thread suspension from another thread under *nix, see added
comments in cthreads.pp why

git-svn-id: trunk@7551 -
2007-06-02 11:39:59 +00:00
Jonas Maebe
3ab9ace8c4 * implement CThreadSwitch using sched_yield()
git-svn-id: trunk@7429 -
2007-05-23 13:38:20 +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
micha
6ec55d2e74 * fix heap mutex deadlock in case of runtime error within heap management (needs recursive heap mutex)
git-svn-id: trunk@7337 -
2007-05-14 21:09:16 +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
bdfd3e5453 * patch from Lloyd B. Park to support persistent signals
for RTLEvent under unix

git-svn-id: trunk@5750 -
2006-12-30 17:28:10 +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
michael
285e02ba83 * Fix to be able to allocate threadvars when code outside FPC creates a thread
git-svn-id: trunk@5474 -
2006-11-25 14:53:53 +00:00
Jonas Maebe
edafc80d8c * use pthread_kill() for Suspend/Resume in cthreads
git-svn-id: trunk@5280 -
2006-11-07 21:40:58 +00:00
Jonas Maebe
4240479f5d * fixed datarace in CBeginThread
git-svn-id: trunk@5274 -
2006-11-07 14:05:09 +00:00
daniel
ce3bfabfe6 - Remove unused sysutils dependency.
git-svn-id: trunk@4965 -
2006-10-18 20:10:02 +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
micha
d704af7216 fix compilation for {$T+} linux/win
git-svn-id: trunk@4794 -
2006-10-04 20:43:55 +00:00
micha
d0e0ef3d8c 2.0.4: pthread_cond_timedwait needs absolute time (from crossbuilder, issue #7196)
git-svn-id: trunk@4296 -
2006-07-25 20:34:20 +00:00
tom_at_work
c5f89d7efd * release old stack pointer register on ppc64 after method prolog
* threading fixes for ppc64
* fixed a_param_ref to respect the size parameter on ppc64
* better stack size calculation for ppc64

git-svn-id: trunk@1599 -
2005-10-26 19:50:17 +00:00
florian
a897adf6cc * try to unlock mutex before destroying it
git-svn-id: trunk@1186 -
2005-09-25 14:27:15 +00:00
michael
859bb30daa + Removed HASTHREADVAR SUPPORT_THREADVAR defines
git-svn-id: trunk@295 -
2005-06-09 17:40:29 +00:00
florian
84958dd3d9 * fixed compilation on x86-64
git-svn-id: trunk@291 -
2005-06-08 21:05:57 +00:00
michael
23ad0ae1ec + Removed HASINTF and VER1_0 defines
git-svn-id: trunk@239 -
2005-06-07 20:30:03 +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
Jonas Maebe
f1a2ef1db2 * don't detach thread when finished, but pthread_exit it
(so it can be joined)

git-svn-id: trunk@184 -
2005-06-03 21:05:14 +00:00
Tomas Hajny
d035b0c0d3 * fix for range error on some platforms
git-svn-id: trunk@178 -
2005-06-03 04:52:24 +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
florian
4aa4aeae79 + TThreadID 2005-04-13 20:10:50 +00:00
florian
90a26e0f7d * fixed some unix stuff 2005-04-09 18:45:43 +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
d18746bd15 * proper error message if the cthreads unit is included too late
uses clause
2005-04-03 19:29:28 +00:00
florian
6d75534cfb * final fix for linux (hopefully) 2005-02-25 22:10:27 +00:00
florian
98106e588c * another "transfer to linux"-commit 2005-02-25 22:02:46 +00:00
florian
69037eaef3 * "transfer to linux"-commit 2005-02-25 21:52:07 +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
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
michael
0b667efe9b + Fixed tmt1 test bug 2004-12-23 20:20:30 +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
florian
8c85454cf9 + added system.align
+ threadvars are now aligned
2004-10-14 17:39:33 +00:00