Module: FFI::Libfuse::Adapter::Context

Included in:
Filesystem::VirtualFS
Defined in:
lib/ffi/libfuse/adapter/context.rb

Overview

Injects a wrapper via #FuseCallbacks#fuse_wrappers make the current FuseContext object available to callbacks (except :destroy) via thread local variable :fuse_context

Class Method Summary collapse

Class Method Details

.fuse_contextObject

Capture FuseContext in thread local variable



27
28
29
# File 'lib/ffi/libfuse/adapter/context.rb', line 27

def fuse_context
  Thread.current[:fuse_context] ||= FuseContext.get
end

.thread_local_context(*args) ⇒ Object



31
32
33
34
35
# File 'lib/ffi/libfuse/adapter/context.rb', line 31

def thread_local_context(*args)
  yield(*args)
ensure
  Thread.current[:fuse_context] = nil
end