New by-need model turned an assertion wrong
Raphael Collet
raph at info.ucl.ac.be
Thu Apr 8 18:02:34 CEST 2004
Raphael Collet wrote:
>
> The assertion was that a space cannot wake up a suspension outside it.
> This assertion is incorrect with the new by-need model. A space must be
> able to make a global variable needed, otherwise you simply get stuck
> when loading the FD module, for instance.
>
> The fix was simply to remove the assertion.
Well, that fix was a bug :P
This Ozcar bug has now be fixed properly.
Technically, the debug stream in AM has been replaced by a port. This
allows a debug message to be sent from inside a subspace, provided the
message does not contain space-sited data. The message never contains
sited data, because only toplevel threads are traced by Ozcar. You can
test the fix with the following example:
declare X
thread {WaitNeeded X} X=1 end
S = {Space.new fun {$} X+1 end}
{Wait {Space.ask S}}
{Show {Space.merge S}}
Launch Ozcar, then feed the lines above. The following scenario shows
that Ozcar correctly handles interactions between the toplevel space and
a subspace:
- Let the thread at line 2 block on X before creating the space.
- After the space is created, you see the thread at line 2 become
runnable as expected.
- Continue the main thread until it blocks on Space.ask.
- Let the "WaitNeeded" thread terminate. This unblocks the thread
inside the space, which makes the space stable. You can see the main
thread unblock.
- Let the main thread terminate.
Cheers,
raph
More information about the mozart-hackers
mailing list