Skip to content

Instantly share code, notes, and snippets.

@navaneeth
Created October 1, 2013 08:24
Show Gist options
  • Save navaneeth/6775384 to your computer and use it in GitHub Desktop.
Save navaneeth/6775384 to your computer and use it in GitHub Desktop.
JRuby Fork implementation
require 'ffi'
module Exec
extend FFI::Library
ffi_lib FFI::Library::LIBC
attach_function :fork, [], :int
end
def fork
pid = Exec.fork
if pid == 0
yield if block_given?
return nil
else
return pid
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment