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

Richard O'Keefe raoknz at gmail.com
Mon Nov 6 00:17:04 AEDT 2023


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 <post at volker-wysk.de> 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
> users at lists.mercurylang.org
> https://lists.mercurylang.org/listinfo/users


More information about the users mailing list