[m-dev.] Globals and concurrency

Peter Wang wangp at students.csse.unimelb.edu.au
Tue Aug 1 17:59:35 AEST 2006


Has there been any thought about how io.set_globals should behave in the
presence of threads, i.e. should the effect of io.set_globals be
reflected in other threads?  The current input/output text/binary
streams should be context-specific data (i.e. the Mercury analogue of
thread-specific data) and it's easy enough for me to make globals
context-specific as well.

If io globals are not context-specific, then there should be a locking
mechanism, otherwise code like:

    io.get_globals(Globals0, !IO),
    foo(Globals0, Globals),
    io.set_globals(Globals, !IO),

is not thread-safe.


Also, what about moving (some of) the concurrency library into the
standard library?  I don't mind if it stays hidden but I'm playing
around with making `mmc --make' launch instances of gcc in parallel, and
doing it using the concurrency library.  (Actually lauching processes in
parallel can be done by forking but that's not the point :-)

Peter

--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to:       mercury-developers at csse.unimelb.edu.au
Administrative Queries: owner-mercury-developers at csse.unimelb.edu.au
Subscriptions:          mercury-developers-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the developers mailing list