# Inter process semaphore

**URL:** <https://www.ruby-forum.com/t/inter-process-semaphore/85207>\
**Category:** Ruby\
**Created:** [February 11, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/inter-process-semaphore/85207 "2007-02-11T13:51:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2007, 1:51pm UTC](https://www.ruby-forum.com/t/inter-process-semaphore/85207/1 "2007-02-11T13:51:12Z")

</div>

Hi!  
Is there a way in ruby to use global system’s semaphore? I am using  
Linux and AFAIK in C you can have many programs using the same  
semaphore, but I do not know how to do this in Ruby :(.  
Best Regards,  
Roman Kamyk

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 11, 2007, 3:57pm UTC](https://www.ruby-forum.com/t/inter-process-semaphore/85207/2 "2007-02-11T15:57:22Z")

</div>

Hi,

> Is there a way in ruby to use global system’s semaphore? I am using  
> Linux and AFAIK in C you can have many programs using the same  
> semaphore, but I do not know how to do this in Ruby :(.

Simple C ext + normal semaphores? AFAIK when calling a C ext, Ruby  
blocks until it’s finished. Using that behaviour, you can write  
a C function which waits/blocks on a semaphore. Keep in mind that  
the whole Ruby process will be blocked since Ruby only has green  
threads.

K
