2011-12-12 03:39:55 +00:00
|
|
|
require 'ffi'
|
|
|
|
|
2011-12-13 03:38:47 +00:00
|
|
|
if RUBY_VERSION =~ /^1.8/
|
2011-12-13 02:51:06 +00:00
|
|
|
require 'process_shared/define_singleton_method'
|
|
|
|
|
2012-02-08 05:06:17 +00:00
|
|
|
class Module
|
|
|
|
include ProcessShared::DefineSingletonMethod
|
2011-12-13 02:51:06 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2012-02-02 01:38:53 +00:00
|
|
|
module ProcessShared
|
|
|
|
case FFI::Platform::OS
|
|
|
|
when 'linux'
|
|
|
|
require 'process_shared/posix/shared_memory'
|
|
|
|
require 'process_shared/posix/semaphore'
|
|
|
|
|
2012-02-08 05:06:17 +00:00
|
|
|
SharedMemory = Posix::SharedMemory
|
|
|
|
Semaphore = Posix::Semaphore
|
2012-02-02 01:38:53 +00:00
|
|
|
when 'darwin'
|
|
|
|
require 'process_shared/posix/shared_memory'
|
|
|
|
require 'process_shared/mach/semaphore'
|
|
|
|
|
2012-02-08 05:06:17 +00:00
|
|
|
SharedMemory = Posix::SharedMemory
|
|
|
|
Semaphore = Mach::Semaphore
|
2012-02-02 01:38:53 +00:00
|
|
|
end
|
|
|
|
end
|
2012-02-08 05:06:17 +00:00
|
|
|
|
|
|
|
require 'process_shared/binary_semaphore'
|
|
|
|
require 'process_shared/mutex'
|
|
|
|
require 'process_shared/condition_variable'
|
2012-03-30 03:33:03 +00:00
|
|
|
require 'process_shared/monitor'
|
2012-02-08 05:06:17 +00:00
|
|
|
|