[m-rev.] for review: avoid a potential deadlock with io.update_globals/3

Julien Fischer juliensf at csse.unimelb.edu.au
Thu Aug 31 14:35:03 AEST 2006


On Thu, 31 Aug 2006, Peter Wang wrote:

> On 2006-08-31, Julien Fischer <juliensf at csse.unimelb.edu.au> wrote:
>>
>> On Thu, 31 Aug 2006, Peter Wang wrote:
>>
>>> and it'd only be worse if multiple threads are
>>> destructively updating a global data structure.
>>
>> How so?
>
> If thread A calls io.get_globals(GA, !IO), and later thread B calls
> io.update_globals(Update, !IO), wouldn't the unique modes allow thread B
> to use destructive update and therefore change the value of GA?

Ah ... good point.  Perhaps io.get_globals should return a unique
copy of the current contents of the globals (or we should just make it
non-unique as you suggest.)

(I imagine how these things are supposed to behave in the presence of
multiple threads hasn't been thought about all that much.)

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



More information about the reviews mailing list