Re: [m-users.] Two more predicates for dealing wih threads

"Richard O'Keefe" <[email protected]> Mon, 6 Nov 2023 02:17:04 +1300
Newsgroups gmane.comp.lang.mercury.general
Message-ID <CABcYAdJfaE7_ShX9GhD-TWjJrcD245PhvGU1R3V9LaZgV6Khkw@mail.gmail.com>
What do these operations actually mean?
When you get an answer from operations like these,
you always have to treat that answer as out of date.
I had a time-of-check/time-of-use bug recently.
It was one of those "check if something exists,
allocate workspace, try to use it" bugs.  The kind
where you go "but that's IMPOSSIBLE.  The code
just *checked* that this thing existed, how could it
not exist, oh wait, this is concurrent...

Is there any way to formulate these things so that
when a thread looks at the result, it tells the thread
something about the state of the world NOW?

On Sun, 5 Nov 2023 at 23:28, Volker Wysk <[email protected]> wrote:
>
> Hi!
>
> I'm playing with threads, and in order to better see what's going on,
> I'd like to have two more predicates:
>
> - One for thread.channel, which returns the current length of the channel.
> - One for thread.semaphore, which returns the current value of the
>   semaphore.
>
> It would be nice, if those could be added.  :)
>
>
> Cheers,
> Volker
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.mercurylang.org/listinfo/users
_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users