Skip to content

Premature thread wakeup #27

@Abhiroop

Description

@Abhiroop

There lurks a bug inside sync where after passing a message between two threads we do the following:

https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/RTS.c#L507

Now imagine the communication is of the kind:

foo =
... sync (send c msg)
...

main =
let _ = spawn foo in
... syncT t1 t2 (recv c)

The sender, using the logic from RTS, will send the message and immediately wake up the main thread. However, the main thread was scheduled to sleep up to time t1. This will be a problem.

The analogue of this problem exists here - https://github.com/svenssonjoel/Sense-VM/blob/master/backend/src/RTS.c#L558-L559

where the sender might be moved to the rdyQ prematurely. This needs to be fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions