Class: PThread::MutexAttr
Constant Summary
Constants included
from Helper
Helper::MAP_FAILED, Helper::MAP_PRIVATE, Helper::MAP_SHARED, Helper::O_CREAT, Helper::O_RDWR, Helper::PROT_EXEC, Helper::PROT_NONE, Helper::PROT_READ, Helper::PROT_WRITE, Helper::PTHREAD_PROCESS_SHARED
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from PThread
call, test
Constructor Details
#initialize(ptr = MutexAttr.alloc) ⇒ MutexAttr
Returns a new instance of MutexAttr.
215
216
217
218
219
220
|
# File 'lib/scratch.rb', line 215
def initialize(ptr = MutexAttr.alloc)
puts "have #{ptr}"
@ptr = ptr
PThread.call { pthread_mutexattr_init(@ptr) }
self.type = type if type
end
|
Class Method Details
.alloc ⇒ Object
210
211
212
|
# File 'lib/scratch.rb', line 210
def alloc
FFI::MemoryPointer.new(Helper.sizeof_pthread_mutexattr_t)
end
|
Instance Method Details
#pointer ⇒ Object
222
223
224
|
# File 'lib/scratch.rb', line 222
def pointer
@ptr
end
|
#pshared=(val) ⇒ Object
226
227
228
|
# File 'lib/scratch.rb', line 226
def pshared=(val)
PThread.call { pthread_mutexattr_setpshared(@ptr, val) }
end
|
#type ⇒ Object
234
235
236
237
238
|
# File 'lib/scratch.rb', line 234
def type
t = FFI::MemoryPointer.new(:int)
PThread.call { pthread_mutexattr_gettype(@ptr, t) }
t.get_int(0)
end
|
#type=(type) ⇒ Object
230
231
232
|
# File 'lib/scratch.rb', line 230
def type=(type)
PThread.call { pthread_mutexattr_settype(@ptr, type) }
end
|