[m-users.] Threads and cc_multi-ness
Volker Wysk
post at volker-wysk.de
Mon Feb 20 03:38:14 AEDT 2023
Hi!
I've tried a trivial program using threads:
:- pred main(io::di, io::uo) is cc_multi.
...
main(!IO) :-
spawn(thread(88), !IO),
io.write_string("99\n", !IO).
:- pred thread(int, io, io).
:- mode thread(in, di, uo) is cc_multi.
thread(I, !IO) :-
io.format("I=%i\n", [i(I)], !IO).
Both main/2 and my thread/3 need to be cc_multi. What surprises me, is that
I get a compiler warning:
threads.m:021: In `thread'(in, di, uo):
threads.m:021: warning: determinism declaration could be tighter.
threads.m:021: Declared `cc_multi', inferred `det'.
... But the samples in samples/concurrency/dining_philosophers, which do it
like my trivial program, get compiled without such a warning message.
I think the warning isn't correct - the determinism declaration could NOT be
tighter. The mode of the spawn/3 predicate forbids making it "det".
So, what about this warning message? Just ignore?
Cheers,
Volker
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mercurylang.org/archives/users/attachments/20230219/87534631/attachment.sig>
More information about the users
mailing list