Commit Graph

16 Commits

Author SHA1 Message Date
Brian Anderson f76e6c39f6 rt: Fix lock_held_by_current_thread
This simplifies the check for thread ownership by removing the _locked flag
and just comparing against the thread ID of the last thread to take the lock.
If the running thread took the lock _holding_thread will be equal to
pthread_self(); if _holding_thread is some other value then the running thread
does not have the lock.

Setting a pthread_t to 0 like this is not portable but should work on every
platform we are likely to care about for the near future.
2012-02-01 16:06:58 -08:00
Brian Anderson 6b5f7865be rt: Remove unused variable from lock_and_signal 2012-02-01 16:06:21 -08:00
Erick Tryzelaar a8943f3442 timeout_in_ns was renamed to timeout_in_ms. 2011-08-03 19:28:49 -07:00
Eric Holk 7a2e9f4874 Sleep for a nonzero amount of time on Windows. 2011-08-03 18:21:19 -07:00
Eric Holk 3d7016ae95 Updating to work on Windows. 2011-07-28 10:47:29 -07:00
Eric Holk a5fe66e706 Adding upcalls to to ref() and deref() tasks. This is the first step towards atomic reference counting of tasks. 2011-07-28 10:47:28 -07:00
Eric Holk 5302cde188 Made task threads wait instead of sleep, so they can be woken up. This appears to give us much better parallel performance.
Also, commented out one more unsafe log and updated rust_kernel.cpp to compile under g++
2011-07-28 10:47:28 -07:00
Graydon Hoare 39151f2ad8 Prohibit trailing whitespace under 'tidy' script. Clean up all caught cases. 2011-07-13 15:44:09 -07:00
Graydon Hoare bc9fa31618 A little tidying in rt. 2011-06-27 10:08:57 -07:00
Eric Holk 022ebc198b Implementation mising features in lock_and_signal for Win32. Also lowered the minimum stack size to get the pfib benchmark to run without exhausting its address space on Windows. 2011-06-27 09:58:39 -07:00
Eric Holk 681c063ec0 Conservatively serialize nearly all upcalls. Successfuly ran make check with RUST_THREADS=8, so we're probably fairly safe now. In the future we can relax the synchronization to get better performance. 2011-06-27 09:58:39 -07:00
Eric Holk 4bc773465f Basic multithreading support. The infinite loops test successfully maxes out the CPU. 2011-06-27 09:58:39 -07:00
Eric Holk d1857d30fc This is the mega-ucontext commit. It replaces the task switching mechanism with a new one inspired by ucontext. It works under Linux, OS X and Windows, and is Valgrind clean on Linux and OS X (provided the runtime is built with gcc).
This commit also moves yield and join to the standard library, as requested in #42. Join is currently a no-op though.
2011-06-13 18:14:13 -07:00
Erick Tryzelaar 501201a431 Remove executable bit from lock_and_signal.cpp. 2011-06-09 12:30:57 -07:00
Michael Bebenita f985fded3e Added lock_and_signal::signal_all(), and made the rust_kernel::join() use wait instead of yield. 2010-09-10 14:38:31 -07:00
Graydon Hoare 616b7afb72 Tidy up the sync dir, remove dead or mis-designed code in favour of OS primitives, switch rust_kernel to use a lock/signal pair and wait rather than spin. 2010-09-08 19:13:49 -07:00