# Ruby fork from C program

**URL:** <https://rubytalk.org/t/ruby-fork-from-c-program/55073>\
**Category:** ruby-talk\
**Created:** [25 August 2009 18:25 UTC](https://rubytalk.org/t/ruby-fork-from-c-program/55073 "2009-08-25T18:25:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [25 August 2009 18:25 UTC](https://rubytalk.org/t/ruby-fork-from-c-program/55073/1 "2009-08-25T18:25:07Z")

</div>

As a learning exercise I'm goofing around with ruby's fork within a C  
program.

I've posted my current testing code here: [http://pastie.org/591998](http://pastie.org/591998)

It seems to give me the output I was expecting however, it waits the  
entire 10 seconds before it proceeds to the next fork call.

I thought maybe sleep is somehow blocking or there are likely other  
things I don't really understand.

Can anyone give me any ideas?

I'm using ruby 1.9.

The goal is to launch ruby processes from this C program.

Thanks for any help you might provide.

Mike B.

---

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [27 August 2009 21:50 UTC](https://rubytalk.org/t/ruby-fork-from-c-program/55073/2 "2009-08-27T21:50:14Z")

</div>

Can anyone provide any help on this little snippet? Maybe it's just  
wrong.

Mike B.

> **···**
>
> On Aug 25, 10:20 am, barjunk \<barj...@attglobal.net\> wrote:
> 
> > As a learning exercise I'm goofing around with ruby's fork within a C  
> > program.
> > 
> > I've posted my current testing code here:[http://pastie.org/591998](http://pastie.org/591998)
> > 
> > It seems to give me the output I was expecting however, it waits the  
> > entire 10 seconds before it proceeds to the next fork call.
> > 
> > I thought maybe sleep is somehow blocking or there are likely other  
> > things I don't really understand.
> > 
> > Can anyone give me any ideas?
> > 
> > I'm using ruby 1.9.
> > 
> > The goal is to launch ruby processes from this C program.
> > 
> > Thanks for any help you might provide.
> > 
> > Mike B.
