Skip to content

Commit

Permalink
[IE][VPU]: changed calling of sem_timedwait() to account for EINTR er…
Browse files Browse the repository at this point in the history
…ror code (openvinotoolkit#6213)

changed calling of sem_timedwait() to account for EINTR error code, so it would be restarted.
  • Loading branch information
Polina Brzezinskaya authored Jun 25, 2021
1 parent 56adef7 commit 5f90f33
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0
//

#include <errno.h>
#include "XLinkSemaphore.h"
#include "XLinkErrorUtils.h"
#include "XLinkLog.h"
Expand Down Expand Up @@ -104,7 +105,9 @@ int XLink_sem_timedwait(XLink_sem_t* sem, const struct timespec* abstime)
XLINK_RET_ERR_IF(abstime == NULL, -1);

XLINK_RET_IF_FAIL(XLink_sem_inc(sem));
int ret = sem_timedwait(&sem->psem, abstime);
int ret;
while(((ret = sem_timedwait(&sem->psem, abstime)) == -1) && errno == EINTR)
continue;
XLINK_RET_IF_FAIL(XLink_sem_dec(sem));

return ret;
Expand Down

0 comments on commit 5f90f33

Please sign in to comment.