mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-12 14:59:44 +03:00
test: threads: Use pthread_testcancel()
`pthread_testcancel()` is a guaranteed cancellation point, specifically for testing if cancellation has been requested, so use it. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
1df8091e63
commit
ce333ad0d2
1 changed files with 1 additions and 7 deletions
|
@ -52,14 +52,8 @@ protected:
|
||||||
{
|
{
|
||||||
cancelled_ = true;
|
cancelled_ = true;
|
||||||
|
|
||||||
/*
|
|
||||||
* Cancel the thread and call a guaranteed cancellation point
|
|
||||||
* (nanosleep).
|
|
||||||
*/
|
|
||||||
pthread_cancel(pthread_self());
|
pthread_cancel(pthread_self());
|
||||||
|
pthread_testcancel();
|
||||||
struct timespec req{ 0, 100*000*000 };
|
|
||||||
nanosleep(&req, nullptr);
|
|
||||||
|
|
||||||
cancelled_ = false;
|
cancelled_ = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue