process_shared/lib/process_shared.rb

32 lines
708 B
Ruby
Raw Normal View History

2011-12-12 03:39:55 +00:00
require 'ffi'
if RUBY_VERSION =~ /^1.8/
require 'process_shared/define_singleton_method'
class Module
include ProcessShared::DefineSingletonMethod
end
end
module ProcessShared
case FFI::Platform::OS
when 'linux'
require 'process_shared/posix/shared_memory'
require 'process_shared/posix/semaphore'
SharedMemory = Posix::SharedMemory
Semaphore = Posix::Semaphore
when 'darwin'
require 'process_shared/posix/shared_memory'
require 'process_shared/mach/semaphore'
SharedMemory = Posix::SharedMemory
Semaphore = Mach::Semaphore
end
end
require 'process_shared/binary_semaphore'
require 'process_shared/mutex'
require 'process_shared/condition_variable'