[m-users.] Threads and cc_multi-ness

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
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

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmPyUHYACgkQ+K4ydFOs
HoVUKRAAiDKKooVYrHzeshz97qbyYKlpXSIV1OUpgVhTu9enjoY8dFeySKOL0iqa
SbsKmu0RVT4RWS5mMzLLe9H7hbdzS52EuiBnJdTwQW+mcjbCwgujatiM+JYZz2QR
Ysrf5rNyOpZIVxRs9B9ZA9pEyHyUIXQHDjcsstenitper/ricLGFO64b5CvaenYj
nZc7DHJyP9ktgW7p5D5EE8x51RCyVX1m12EwzpVr/Ri5xtlvDXqS/UMs5nijiOww
BNkMvDxQZFB3EFQWO9YS+xkO7yzOH9Ck/C9tlOMJND1LTiqZ42as2N7siEZyffNx
+ce+2BfdBhLlxennL7UXIuhvrtXGqtlQvzoTpN7zuj68jATi77Vt6nsOQ0l5Vbc9
Duk7LMcYb4okZ2VdmN+GfUgfYvPiIBbBtsOMkeW0zrhZckOhxxy/VE791Kq2rxCs
QMeW1NIoHWqj8UynxC7p+gylHRfFjUyzMgHZbRe+QTQmSyrm/6Y2qa7gOMmzdo/R
EPkE/wRIwSvNWzys6fEdr1tlm5FjWySmlnOQybzHJxwQKxkwqloqZP85b1FL0r7V
XVAnQhE6RHFIaSzORKOMUJe0YN7df0o8QKwraEL5Lqjhjj/ybeHOJS50LsF8Sehd
PrVyf+q+KyqjTjhAuzn7LJQvl8JGczCCMiQTqQeYo7LiWFVlvvQ=
=WB81
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.