[m-rev.] for review: avoid deadlock in tabled_read_unitize test

Zoltan Somogyi zs at cs.mu.OZ.AU
Wed Aug 28 16:33:44 AEST 2002


On 28-Aug-2002, Fergus Henderson <fjh at cs.mu.OZ.AU> wrote:
> tests/debugger/tabled_read_unitize.m:
> 	Declare the `unitize' C foreign_proc to be thread-safe,
> 	This is needed to prevent deadlocks in `.par' grades, since in
> 	those grades it acquires the global lock and then calls back
> 	Mercury code which tries to reacquire that lock.

The diff you posted is fine as far as it goes, but it looks like we should
change the compiler to check for this. A foreign_proc with a unitize annotation
should have either

- a thread_safe annotation, or
- a new annotation asserting that the callbacks to Mercury will not call any
  non-thread-safe foreign_procs.

This check would be needed only in .par grades, of course.

Zoltan.
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list