Re: non critical-section uses of mutexes Marc Feeley (27 Apr 2000 17:51 UTC)
Re: non critical-section uses of mutexes Marc Feeley 27 Apr 2000 17:51 UTC
> But that was exactly the point of the original example: T1 was NOT in
> an explicit critical section, when it was killed. As I understand the
> example uses mutexes specifically for the purpose _other_ than to
> introduce a critical section.
Actually I came up with the mailbox example to show how mutexes could
be used to implement other things than critical sections. As you
point out, this is a questionable example because it doesn't support
thread termination very well (but in a context that does not forcibly
terminate threads it would be a fine use of mutexes). The use of
mutex-lock-anonymously! in my code was to prevent "abandoned mutex"
exceptions upon **normal** thread termination followed by a put! or
> It appears that you have already given a solution to the problem.
> In a message
> you showed an example that uses a mutex just to guard a critical
> section. If that example is modified as
I agree that the condition-variable approach is viable, and the way to
go to implement the mailbox in the presence of forced thread
termination. My comment was simply that I did not see how the problem
could be solved with mutexes alone given the current semantics.