Adjust Worker terminology

- Posting a task to a worker for execution (without implicit wait)
  is called "post".
- Posting a task to every worker for execution (without implicit wait)
  is called "broadcast".

In these cases the task must be provided as a pointer or auto_ptr, to
indicate that the provided pointer must remain alive for longer than
the duration of the function call.

- Posting a task to a worker for execution *and* waiting for all workers
  to have executed the task is called "execute" and the two variants are
  now called "execute_concurrently" and "execute_serially".

In these cases the task is provided as a reference, since the functions
will return only when all workers have (in concurrent or serial fashion)
executed the task. That is, it need not remain alive for longer than the
duration of the function call.
This commit is contained in:
Johan Wikman
2017-05-02 11:22:37 +03:00
parent 1b58a75f42
commit 00b6c10089
3 changed files with 38 additions and 35 deletions

View File

@ -3069,7 +3069,7 @@ private:
bool dcb_foreach(bool(*func)(DCB *dcb, void *data), void *data)
{
SerialDcbTask task(func, data);
Worker::execute_on_all_serially(&task);
Worker::execute_serially(task);
return task.more();
}
@ -3104,9 +3104,8 @@ private:
void dcb_foreach_parallel(bool(*func)(DCB *dcb, void *data), void **data)
{
Semaphore sem;
ParallelDcbTask task(func, data);
sem.wait_n(Worker::execute_on_all(&task, &sem));
Worker::execute_concurrently(task);
}
int dcb_get_port(const DCB *dcb)