Google


   


You are here: CodeIdol.com > Other > Ruby Cookbook > Multitasking And Multithreading

SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

Ruby Cookbook



Recipe 20.1. Running a Daemon Process on Unix Problem You want to run a process in the background with minimal interference from users and the operating system. Solution In Ruby 1.9, you can simply call Process.daemon to turn the cur...



Recipe 20.2. Creating a Windows Service Credit: Bill Froelich Problem You want to write a self-contained Ruby program for Windows that performs a task in the background. Solution Create a Windows service using the win32-service librar...



Recipe 20.3. Doing Two Things at Once with Threads Problem You want your program to run two or more pieces of code in parallel. Solution Create a new thread by passing a code block into THRead.new. That block will run simultaneously with ...



Recipe 20.4. Synchronizing Access to an Object Problem You want to make an object accessible from only one thread at a time. Solution Give the object a Mutex member (a semaphore that controls whose turn it is to use the object). Y...



Recipe 20.5. Terminating a Thread Problem You want to kill a thread before the end of the program. Solution A thread terminates if it reaches the end of its code block. The best way to terminate a thread early is to convince it to reach t...



Recipe 20.6. Running a Code Block on Many Objects Simultaneously Problem Rather than iterating over the elements of a data structure one at a time, you want to run some function on all of them simultaneously. Solution Spawn a thread ...



Recipe 20.7. Limiting Multithreading with a Thread Pool Problem You want to process multiple requests in parallel, but you don't necessarily want to run all the requests simultaneously. Using a technique like that in Recipe 20.6 can c...



Recipe 20.8. Driving an External Process with popen Problem You want to execute an external command in a subprocess. You want to pass some data into its standard input stream, and read its standard output. Solution If you don't ...



Recipe 20.9. Capturing the Output and Error Streams from a Unix Shell Command Problem You want to run an external program as in Recipe 20.8, but you also want to capture the standard error stream. Using popen only gives you access to the ...



Recipe 20.10. Controlling a Process on Another Machine Problem You want to run a process on another machine, controlling its input stream remotely, and reading its output and error streams. Solution The ruby-ssh gem, first describ...


SAVE
Digg
Shown on del.icio.us del.icio.us
See Whos Talking About This on Technorati Technorati
I've Reddit reddit

You are here: CodeIdol.com > Other > Ruby Cookbook > Multitasking And Multithreading


ADBRITE ads links
   
Related tags







Popular Categories
Unix books and guides

AJAX popular information
C# language guides
Windows books and cookbooks

.......








Business Key Top Sites

be number one
rate your site


Хотите светлый, теплый и ок дом? Мы предлагаем строительство каркасных домов.

    С 2009 года мы стали переводить структура сайта на различные языки. Сайт теперь будет содержать книги не только на английском языке, но также и на других европейских языках, в том числе и на Русском языке.

    Русский Polski Francais Deutsch
    support sitemap terms

© CodeIdol Labs, 2007 - 2009