[M3devel] LockHeap

Tony Hosking hosking at cs.purdue.edu
Wed Aug 13 21:23:49 CEST 2014

On Aug 12, 2014, at 9:47 PM, mika at async.caltech.edu wrote:

> The code in LockHeap looks dubious to me:

Yes, it was a broken and incomplete attempt.  I’ve reverted to what we used to have that actually works.

> I note that the documentation in RTOS.i3 also seems slightly incorrect:
> PROCEDURE WaitHeap (VAR thread: RTHeapRep.ThreadState);
>     Blocks the caller until BroadcastHeap has been called and the allocator/collector critical section is released. The caller must be in the critical section.
> Shouldn't it say "The calling thread must have entered the critical
> section exactly once."?  (Given that the "LockHeap" is reentrant…)

Yes, true.

> Why is there a reentrant mutex here, anyhow?

Reentrant because it is possible for the collector thread to try to re-enter the collector when performing allocation.  It would be possible to carry a flag down through the recursion, but this is the way it has always been (since DEC SRC days).

More information about the M3devel mailing list