JS: clear active tag inside same synchronized method

When clearing the next process before returning, also clear the active bit.

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
JS: inline releaseProcess in EventManager

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
JS: introduce helpers for waking the next process and killing a process

Fix up the argument type of switchThread while we're at it.

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
JS: pull out separate active and shouldDie flags

These can be modified directly in already-locked sections, do so.

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
JS: pull the conditional wait flag to its own boolean

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
JS: add a simple BooleanSelector class for simple true/false selection

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>
Test: add unit tests for BooleanSelector

Signed-off-by: Harvey Harrison <harvey.harrison@ausenco.com>