[m-dev.] diff: fix another deadlock problem for asm_fast.par.gc
Fergus Henderson
fjh at cs.mu.OZ.AU
Sun Aug 27 03:31:15 AEDT 2000
Estimated hours taken: 1
tests/hard_coded/pragma_import.m:
tests/hard_coded/pragma_export.m:
For `pragma import' declarations that specify C functions
that call back Mercury code, use the `thread_safe' annotation.
This is needed in the *.par* grades to avoid procedures
acquiring the global lock and then calling Mercury code which
needs the global lock, without having released that lock yet.
Probably the compiler ought to issue a warning if any imported C
code is declared `may_call_mercury' but not `thread_safe'.
Workspace: /home/pgrad/fjh/ws/hg
Index: tests/hard_coded/pragma_export.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/pragma_export.m,v
retrieving revision 1.1
diff -u -d -r1.1 pragma_export.m
--- tests/hard_coded/pragma_export.m 2000/08/24 10:01:55 1.1
+++ tests/hard_coded/pragma_export.m 2000/08/26 16:21:42
@@ -15,6 +15,7 @@
:- pred my_write_string(string::in, io__state::di, io__state::uo) is det.
-:- pragma import(my_write_string(in, di, uo), may_call_mercury, "write_str").
+:- pragma import(my_write_string(in, di, uo),
+ [may_call_mercury, thread_safe], "write_str").
:- pragma export(io__write_string(in, di, uo), "write_str").
Index: tests/hard_coded/pragma_import.m
===================================================================
RCS file: /home/mercury1/repository/tests/hard_coded/pragma_import.m,v
retrieving revision 1.2
diff -u -d -r1.2 pragma_import.m
--- tests/hard_coded/pragma_import.m 1998/06/19 00:16:15 1.2
+++ tests/hard_coded/pragma_import.m 2000/08/26 16:20:38
@@ -49,7 +49,7 @@
:- pragma import(foo(in, out, in, out, in, out, di, uo), "cfoo").
:- pragma import(bar(in, out) = out, will_not_call_mercury, "cbar").
:- pragma export(bar(in, out) = out, "mbar").
-:- pragma import(bar2(in, out) = out, may_call_mercury, "mbar").
+:- pragma import(bar2(in, out) = out, [may_call_mercury, thread_safe], "mbar").
:- pragma import(baz(in, out) = out, "cbaz").
:- pragma import(quux(in, out), may_call_mercury, "cquux").
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list