[m-rev.] for review: Delete closeable_channel.is_closed.
Julien Fischer
jfischer at opturion.com
Sun Apr 19 12:35:03 AEST 2020
On Fri, 17 Apr 2020, Peter Wang wrote:
> This is a plausible sequence of events leading to a failure in the
> hard_coded/closeable_channel_test.m test case:
>
> thread A thread B
> -------- --------
> close(Chan)
> channel.take(Chan)
> -> mvar.read(Head)
> -> semaphore.wait(Full)
> is_closed(Chan, IsClosed)
> -> mvar.try_read(Hole)
> -> semaphore.try_wait(Full)
>
> Thread B tries to take the next item from the channel, during which time
> it holds the Full semaphore of the from the mvar at the read end of the
> channel.
>
> Thread A attempts to verify that the channel is really closed.
> It tries to read from the mvar at the write end of the channel, which is
> the same mvar as thread B is reading from (because the channel is empty).
> Thread A cannot acquire the Full semaphore of the mvar as it is being
> held by thread B, resulting in the call is_closed(Chan, IsClosed) to
> return with IsClosed = no.
>
> library/thread.closeable_channel.m:
> Delete the is_closed predicate. It was of questionable utility
> anyway.
>
> tests/hard_coded/closeable_channel_test.m:
> Delete call to is_closed in test case.
That's fine.
Julien.
More information about the reviews
mailing list