Commit Graph

78 Commits

Author SHA1 Message Date
Jonas Maebe
8d8fc0fdee + RTL for AIX
git-svn-id: trunk@20786 -
2012-04-11 17:59:49 +00:00
Jonas Maebe
cc736fe115 * use same code path for iphonesim as for darwin (should fix mantis #21190)
git-svn-id: trunk@20374 -
2012-02-17 20:28:43 +00:00
Jonas Maebe
bfc1a6ff1c + added support for intialising/finalising threads not started via the FPC
runtime

git-svn-id: trunk@15557 -
2010-07-12 16:16:50 +00:00
marco
8cce3d3f91 * closethread thread manager field/function. Mantis 13160
git-svn-id: trunk@15072 -
2010-03-26 23:31:52 +00:00
Jonas Maebe
4d8f578e4c * when typecasting the result of pthread_self, always call it using
pthread_self(), because it's a procvar under Linux and hence otherwise
    the value of the procvar instead of the function result will be
    taken (mantis #15821)

git-svn-id: trunk@15049 -
2010-03-24 21:51:07 +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
9cd0a2ff1e * link to libpthread at compile time on Linux to avoid problems on some
newer glibc systems when it's only loaded dynamically at run time

git-svn-id: trunk@14970 -
2010-03-04 15:36:35 +00:00
pierre
048b2ba67b * fix pthread problem wen using nice for solaris
git-svn-id: trunk@14823 -
2010-01-28 19:05:42 +00:00
Jonas Maebe
c2190ebd30 * return errors from unimplemented functions instead of random values
git-svn-id: trunk@14002 -
2009-11-01 15:41:29 +00:00
Jonas Maebe
b92df02778 * new Intbasicevent*() implementation based on pthread_cond_signal by
Fabio Luis Girardi (mantis #9895)

git-svn-id: trunk@12857 -
2009-03-04 20:15:27 +00:00
Jonas Maebe
9e7efd7321 * reduced waiting steps in emulated "timed wait" in basiceventwaitfor
further from 50ms to 20ms (mantis #9895)

git-svn-id: trunk@12813 -
2009-02-27 21:36:55 +00:00
florian
c127154efa o Haiku patches by Olivier Coursiere
+ add posix thread support
  * improve signal handling
  * synchronize haiku's baseunix unit with the unix one (maybe it will be possible to remove Haiku's one in a future patch, but i keep it for now)
  + add support for standard sockets
  * fix some functions import to use the right libraries under Haiku
  * fix packages compilation

git-svn-id: trunk@12636 -
2009-02-01 10:30:55 +00:00
Jonas Maebe
1a1fc1357d * honour the specified stack size when creating new threads on unix
platforms + test (mantis #12942)

git-svn-id: trunk@12527 -
2009-01-08 18:37:24 +00:00
Jonas Maebe
4f5513466a * reverted r11671 because it breaks tthread.waitfor on unix
git-svn-id: trunk@11731 -
2008-09-08 21:10:38 +00:00
michael
c179162028 * Call EndThread manually if thread function returns (mantis #11490)
git-svn-id: trunk@11671 -
2008-08-30 21:48:39 +00:00
Jonas Maebe
34d0fd2c30 * give generic IntbasiceventWaitFor a granularity of 50 rather than
500 miliseconds

git-svn-id: trunk@9222 -
2007-11-12 22:06:39 +00:00
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