You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1. When creating the future, set the future's flag, which is akin to
assigning the job. Afterward, transfer the ownership to the worker.
Once the worker completes the job, clear the flag and return the
ownership, which is akin to submitting a job. Then, the main thread
can regain ownership. By doing this, the main thread can wait directly
for the result through test and set without checking if the result is
NULL. This avoids the situation where the flag could be set to true by
the main thread before the worker starts the job. Additionally, the
worker does not need to check with test and set before performing the
job.
2. Drop the `atomic_flag_clear` in `tpool_future_wait` function and then
directly free the pointer of future and its result in
`tpool_future_destroy` function.
3. Rename the variable 'lock' in the future structure to 'flag'. Rename
the function name `tpool_future_get` to `tpool_future_wait`.
Co-authored-by: Chih-Wei Chien <[email protected]>
Signed-off-by: Wei-Hsin Yeh <[email protected]>
0 commit comments