[Haskell-cafe] Re: [Haskell] Top Level <-

Brandon S. Allbery KF8NH allbery at ece.cmu.edu
Sun Aug 31 11:55:45 EDT 2008

On 2008 Aug 31, at 11:20, Ganesh Sittampalam wrote:
> On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
>> On 2008 Aug 31, at 10:44, Ganesh Sittampalam wrote:
>>> In that case it seems that any library that might be used from a  
>>> runtime that isn't the top-level of a process should avoid doing  
>>> IO to those handles, for fear of producing output corruption?
>> You handle it the same way you handle I/O with concurrency:  either  
>> one of the runtimes is "privileged" to the extent that it owns the  
>> filehandles and other runtimes must make an inter-runtime call to  
>> use them, or the filehandle structures include locking and are  
>> shared across runtimes.  Both of these are used in Haskell (see  
>> most GUI libraries for the former, and the implementation of  
>> Handles for the latter).
> Where do the filehandle structures live in the latter case?

The place you clearly think so little of that you need to ask:   
process-global (or process-local depending on how you think about it)  
storage.  And everything in that storage must have locking.  (And this  
requirement makes it similar in some ways to other non-directly- 
accessible process state such as (say) the process id.)

brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university    KF8NH

More information about the Haskell-Cafe mailing list