Unix Semaphores in Squeak?

Daniel B. Faken faken at cascv.brown.edu
Mon Sep 27 14:07:56 UTC 2004


On Wed, Sep 22, 2004 at 10:40:31AM -0400, Daniel B. Faken wrote:
> Hello,
> 
>   Has anyone implemented an interface to Unix (SYSV) semaphores within 
> Squeak?  I looked in AIO and OSProcess, but they seem to just use Squeak 
> Semaphores and Unix Signals.
>   (I've implemented a rudimentary interface to SYSV shared-memory, but
> if anyone has a nice version that would be great)

David T Lewis wrote:
> I doubt that anyone has done this, but I could be wrong. I know that I 
> didn't put it in the OSProcessPlugin.
>
> If I remember right, the SYSV ipc calls all use integer parameters and 
> have integer return values, so it would be straightforward to make a 
> plugin.
>
> If you are comfortable doing plugins, I think that the quickest way for 
> you to get this done would be to just add some more primitives to 
> UnixOSProcessPlugin.
> Once you get it working, move your new stuff into its own plugin 
> (SysvIpcPlugin), and put it on Squeak Map. That's more or less how I did 
> the AIO plugin.
>
> Just curious, why would you want to use Unix semaphores from Squeak?
> 
> Dave

in response, Lex wrote:
> If that's true, then FFI should also work very well.  No VM changes
> would then be required. -Lex

Thanks for your responses, Dave & Lex.

  I wanted to use SYSV semaphores to communicate with some external 
processes that I'm using with Croquet.  
  I had already implemented shared-memory functionality via the FFI, and 
after looking at the semaphore functions/data-structures decided I would 
just stay with shared-mem for now until I need more.. one problem I saw 
implementing semaphores with the FFI was that some of the parameters that 
needed passing were unions (not pointers to unions), and I didn't want to 
try to figure out how to do that via the FFI.
  Maybe I'll make a plugin later.. anyway I do plan to make the 
shared-memory stuff (which is actually pretty trivial) available sometime 
soon..

cheers,
Daniel Faken





More information about the Squeak-dev mailing list