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

Fergus Henderson fjh at cs.mu.OZ.AU
Wed Aug 28 14:21:59 AEST 2002


Estimated hours taken: 1
Branches: main

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.

Workspace: /home/ceres/fjh/mercury
Index: tests/debugger/tabled_read_unitize.m
===================================================================
RCS file: /home/mercury1/repository/tests/debugger/tabled_read_unitize.m,v
retrieving revision 1.1
diff -u -d -r1.1 tabled_read_unitize.m
--- tests/debugger/tabled_read_unitize.m	26 Jul 2002 04:20:14 -0000	1.1
+++ tests/debugger/tabled_read_unitize.m	28 Aug 2002 04:18:42 -0000
@@ -58,7 +58,11 @@
 
 :- pragma foreign_proc("C",
 	tabled_read_unitize__unitize(Stream::in, N::out, _IO0::di, _IO::uo),
-	[may_call_mercury, promise_pure, tabled_for_io_unitize],
+	[may_call_mercury, promise_pure, tabled_for_io_unitize,
+	% This needs to be declared as thread safe, otherwise it deadlocks
+	% in `.par' grades, since it acquires the global lock and then
+	% calls back Mercury code which tries to reacquire that lock.
+	thread_safe],
 "
 	MR_Integer	int1;
 	MR_Integer	int2;

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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