[Haskell-cafe] Re: [Haskell] Re: Global Variables and whatever

Keean Schupke k.schupke at imperial.ac.uk
Tue Nov 9 07:52:05 EST 2004

>as i said in my other post (waiting for moderator approval), there
>are many people on this thread, and i'm not sure they are all talking
>about the same thing. perhaps a good step forward would be for 
>each concrete proposal to go into a separate thread (beginning 
>with a summary of the use pattern to be covered and the concrete 
>extension proposal claiming to do the job), and then to see whether 
>there is any consensus for any of them.
Well, my suggestion for one-shot routines would be to implement
a simple Haskell library supporting named semaphores, and named
channels. These resources need to be managed by the OS, so on
unix the obvious way to implement them is to use unix-domain
sockets for the channels, but their might be a more efficient way.

    oneTimeInit = do
       s <- testAndSetSemaphore "myUniqueString"
       if s
          then -- already run
          else -- not run yet


More information about the Haskell-Cafe mailing list