On 2008 Aug 31, at 13:20, Ganesh Sittampalam wrote:
On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
On 2008 Aug 31, at 12:01, Ganesh Sittampalam wrote:
On Sun, 31 Aug 2008, Brandon S. Allbery KF8NH wrote:
On 2008 Aug 31, at 11:20, Ganesh Sittampalam wrote:
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.
You'll have to look at specific implementations. One that I can
think of off the top of my head is Perl 5's "ithreads"; there is a
distinguished allocation store which is global to all ithreads, and
the interpreter instance gives you primitives for locking and
mutexing (see "use threads::shared;").
I'm afraid I don't see how this generalises to sharing something
across an entire process where the things that want to do the
sharing are not in or controlled by the same shared library. In
particular the filehandle structures required for buffered I/O need
to be common to every single piece of code in the process that might
want to use them, no matter what language or language implementation
that code uses.
For that you probably want to look at how ld.so.1 and libc interact to
share the malloc pool and the stdin/stdout/stderr, among others.
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] [EMAIL PROTECTED]
system administrator [openafs,heimdal,too many hats] [EMAIL PROTECTED]
electrical and computer engineering, carnegie mellon university KF8NH
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe