Commit Graph

40 Commits

Author SHA1 Message Date
Patrick Mahoney 25f9bb2cae Remove Ruby 1.8 special case; reorder requires to suppress warning. 2013-12-31 20:17:15 -06:00
Marc Siegel 49773b66f4 Add Semaphore#to_mtx returning an unchecked mutex-like facade
Because there is a very significant performance hit for using the
mutex implementation, which correctly checks ownership, this
implementation formalizes treating a raw semaphore as a faster,
unchecked implementation of mutex.
2013-12-30 13:20:29 -05:00
pmahoney 1b1fdbe287 Merge pull request #8 from ms-ati/fix-cond-var-signal-when-no-waiters
Fix ConditionVariable#signal to only post if semaphore has waiters
2013-12-27 14:49:04 -08:00
Marc Siegel 14fa8662f5 Fix test on 1.9.x by adding magic file encoding comment 2013-12-27 15:21:01 -05:00
Marc Siegel 4518e6fdad Fix ConditionVariable#signal to only post if semaphore has waiters
This fixes a bug where calls to #signal would end up "over-posting"
the semaphore, causing subsequent waits to return immediately until
the semaphore value is back down to zero.
2013-12-27 15:15:07 -05:00
Marc Siegel 41b6777638 Fix SharedMemoryIO#read for binary data on Ruby 1.9+ 2013-12-27 13:38:23 -05:00
Marc Siegel aeadb74ef6 Fix Mutex to allow lock from different Ruby (green) thread in process 2013-12-27 10:46:50 -05:00
Marc Siegel 90a9f37da4 Disable test on 1.8.7, since workaround is to allow blocking on that version 2013-12-26 13:51:03 -05:00
Marc Siegel d3d51fef91 Moved tests to just semaphore, and fixed thread joining 2013-12-26 13:28:40 -05:00
Marc Siegel 50c096d84c On mach, allow other ruby threads to continue during semaphore try_wait 2013-12-26 12:45:04 -05:00
Marc Siegel d1644104c8 On mach, allow other ruby green threads to continue during semaphore wait 2013-12-26 12:27:36 -05:00
Patrick Mahoney 5aba20cdf7 Partial MonitorMixin implementation. 2012-03-29 23:00:52 -05:00
Patrick Mahoney 1eff930480 Initial attempt at Monitor class. 2012-03-29 22:33:03 -05:00
Patrick Mahoney d012a11237 Add LockBehavior to semaphore spec. 2012-02-23 21:37:19 -06:00
Patrick Mahoney 5dc3c7299e Move common lock test behavior out of mutex spec into module. 2012-02-23 21:33:38 -06:00
Patrick Mahoney d373ed5996 Revert debugging change to unit test. 2012-02-08 21:29:37 -06:00
Patrick Mahoney 359d44b6f3 Use original fork in mach unit test rather than possibly overridden fork. 2012-02-08 21:29:03 -06:00
Patrick Mahoney 45e6425311 Be more sleepy in test to ensure failure when not locking. 2012-02-08 21:12:06 -06:00
Patrick Mahoney 15fe2e5057 Refactor class hierarchy, implementation selection details. 2012-02-07 23:06:17 -06:00
Patrick Mahoney 0aab64eaff Skip Semaphore#value test on Mac OS X where it is unsupported. 2012-02-01 21:45:54 -06:00
Patrick Mahoney 842ff179ec Remove no-longer-used libpsem and related code and tests. 2012-02-01 21:42:34 -06:00
Patrick Mahoney 8158666e90 Add posix-y compatibility extension class over Mach::Semaphore. 2012-02-01 21:36:15 -06:00
Patrick Mahoney 6f63c67c6e Split SharedMemory into module and platform dependent bits. Make SharedArray extend platform dependent class. 2012-02-01 19:38:53 -06:00
Patrick Mahoney db108a1913 Delete BoundedSemaphore. 2012-02-01 19:24:07 -06:00
Patrick Mahoney 74acbae899 Add test demonstrating copying semaphore from parent to child. 2012-01-21 18:39:47 -06:00
Patrick Mahoney 9f17aac114 Modify args to Semaphore and Port constructors to accept existing ports. 2012-01-16 08:14:58 -06:00
Patrick Mahoney 252d606c09 Add FFI wrapper around some of the Mach API (in Mac OS X). 2012-01-15 08:02:53 -06:00
Patrick Mahoney 70b372136d Re-add require 'process_shared' to spec_helper. 2011-12-20 22:20:30 -06:00
Patrick Mahoney cc663a8d7f Add SharedMemory#write_object and #read_object; add SharedMemoryIO helper. 2011-12-20 22:09:38 -06:00
Patrick Mahoney cf6b821b17 Remove development dependency on simplecov. 2011-12-20 19:57:15 -06:00
Patrick Mahoney 611c41f939 Add SharedArray extension of SharedMemory (with Enumerable mixin). 2011-12-17 21:51:22 -06:00
Patrick Mahoney c320c75c8d Add SimpleCov coverage when running tests under 1.9 (though it doesn't seem to measure correctly...?). 2011-12-17 21:50:12 -06:00
Patrick Mahoney d65979cc2e Initial attempt at ConditionVariable implementation. 2011-12-17 11:05:39 -06:00
Patrick Mahoney 7d71937bf7 Add BinarySemaphore (error checking semaphore with max value 1). 2011-12-17 10:15:22 -06:00
Patrick Mahoney a0d0c7575c Test Semaphore#try_wait() that doesn't end in ETIMEDOUT. 2011-12-17 10:06:24 -06:00
Patrick Mahoney 7230e9f2c9 Add Semaphore#try_wait. Fix libpsem to convert relative timeout to absolute timeout. 2011-12-17 09:58:10 -06:00
Patrick Mahoney faa8a6c5b3 Test RUBY_VERSION rather than VERSION (which no longer exists in 1.9). 2011-12-12 21:38:47 -06:00
Patrick Mahoney 4f775ac5ca Add backwards compatibility define_singleton_method for Ruby 1.8. 2011-12-12 20:51:06 -06:00
Patrick Mahoney b4b869e074 Check double-lock in Mutex. Update book keeping on unlock. 2011-12-11 22:57:57 -06:00
Patrick Mahoney cf45ab9891 Initial commit. 2011-12-11 21:39:55 -06:00