Commit Graph

3 Commits

Author SHA1 Message Date
Jiawei Shao 5d39860fef Implement AsyncWaitableEvent with std::condition_variable
This patch implements the default implementation of WaitableEvent
(AsyncWaitableEvent) with std::condition_variable instead of
std::future as std::future will always block its destructor until
the async function returns, which makes us unable to clean up all
the execution environment of the async task inside the async
function.

This patch also implements WorkerThreadTaskManager to manage all
the async tasks (inherited from WorkerThreadTask) in the future,
for example all the Create*PipelineAsync() tasks.

This patch also updates the related dawn_unittest WorkerThreadTest.
Basic.

BUG=dawn:529
TEST=dawn_unittests

Change-Id: Ie789ba788789e91128ffc416e7e768923828a367
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/51740
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-05-27 00:49:03 +00:00
Jiawei Shao c952097dc6 Remove incorrect ASSERT in ~AsyncWaitableEvent
This patch removes an incorrect ASSERT(IsComplete()) in the
destructor of AsyncWaitableEvent because when the destructor of
AsyncWaitableEvent is called, the async task attached to mFuture
may not be completed and the status of mFuture may not be 'ready'.
In fact in C++14 we can always guarantee the attached async task
is completed after the destruction of mFuture.

BUG=dawn:529

Change-Id: I2f28246beb025a0d39dd432a404c0b04aed17249
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/48900
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-04-27 02:50:46 +00:00
Jiawei Shao 064f33e441 Implement WaitableEvent and WorkerTaskPool for multi-threaded tasks
This patch adds the basic implementation of WaitableEvent and
WorkerTaskPool for multi-threaded tasks in Dawn (for example, the
multi-threaded implementation of CreateReady*Pipeline()).

BUG=dawn:529
TEST=dawn_unittests

Change-Id: Ibf84348f4c0f0d26badc19ae94cd536cef89d084
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/36360
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
2021-01-20 08:56:07 +00:00