Commit 0d5bab04 authored by Matthew Fernandez's avatar Matthew Fernandez
Browse files

adapt rendezvous/exit protocol to cope with multiple threads

We now deal with the fact that a thread may exit *prior* to another thread
attempting a rendezvous. This commit makes the following changes:

  * We now keep an outstanding count of "running" or "active" threads. This is
    used to detect when we are the last remaining thread leaving the rendezvous
    protocol.
  * All exiting now goes through a new function, exit_with(). This function
    deals with the noise of "are we a master or subordinate thread?"

TODO: explore() still does not check the value of 'done' periodically. This
means one thread can encounter an error and the others won't notice until they
finish checking and decide to exit.

The logic in this commit is pretty subtle and no doubt going fully multithreaded
will expose some weaknesses in it.
parent 97470ccc
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment