View Single Post
  #13 (permalink)  
Old 04-03-2008, 09:53 PM
shaalini shaalini is offline
D-Web Analyst
 
Join Date: Apr 2007
Posts: 342
shaalini is on a distinguished road
Default Re: Ruby BuiltIn functions

exit!
exit!( anInteger=-1 )


Similar to Kernel::exit , but exception handling, at_exit functions, and finalizers are bypassed.

fail

fail
fail( aString )
fail( anException [, aString [ anArray ] ] )


Synonym for Kernel::raise .

fork
fork [{ block } ] -> aFixnum or nil
Creates a subshell. If a block is specified, that block is run in the subshell, and the subshell terminates with a status of zero. Otherwise, the fork call returns twice, once in the parent, returning the process id of the child, and once in the child, returning nil. The child process can exit using Kernel::exit! to avoid running any at_exit functions. The parent process should use Process::wait to collect the termination statuses of its children; otherwise, the operating system may accumulate zombie processes.

fork do
3.times {|i| puts "Child: #{i}" }
end
3.times {|i| puts "Parent: #{i}" }
Process.wait

produces:

Parent: 0
Child: 0
Parent: 1
Child: 1
Parent: 2
Child: 2
__________________
Shaalini.S
Be the Best of Whatever you are...
Reply With Quote