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'
|
|
|
|
|
|
|
|
module ProcessShared
|
|
|
|
module PSem
|
|
|
|
extend DefineSingletonMethod
|
|
|
|
end
|
|
|
|
|
|
|
|
module RT
|
|
|
|
extend DefineSingletonMethod
|
|
|
|
end
|
|
|
|
|
|
|
|
module LibC
|
|
|
|
extend DefineSingletonMethod
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-12-12 03:39:55 +00:00
|
|
|
require 'process_shared/semaphore'
|
2012-02-02 01:38:53 +00:00
|
|
|
require 'process_shared/binary_semaphore'
|
2011-12-12 03:39:55 +00:00
|
|
|
require 'process_shared/mutex'
|
|
|
|
require 'process_shared/shared_memory'
|
2011-12-13 02:51:06 +00:00
|
|
|
|
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'
|
|
|
|
|
|
|
|
SharedMemory.impl = Posix::SharedMemory
|
|
|
|
Semaphore.impl = Posix::Semaphore
|
|
|
|
when 'darwin'
|
|
|
|
require 'process_shared/posix/shared_memory'
|
|
|
|
require 'process_shared/mach/semaphore'
|
|
|
|
|
|
|
|
SharedMemory.impl = Posix::SharedMemory
|
|
|
|
Semaphore.impl = Mach::Semaphore
|
|
|
|
end
|
|
|
|
end
|