lib: drop redundant switch to async cancelability

oob_ioctl() already switches the caller to async cancelability, there
is no need for the caller to do this.
This commit is contained in:
Philippe Gerum 2019-06-14 13:00:17 +02:00
parent f0d37f4730
commit 61d7d212cd
4 changed files with 4 additions and 15 deletions

View File

@ -201,7 +201,7 @@ int evl_timedwait_event(struct evl_event *evt,
{
struct evl_monitor_waitreq req;
struct unwait_data unwait;
int ret, old_type;
int ret;
ret = check_event_sanity(evt);
if (ret)
@ -215,9 +215,7 @@ int evl_timedwait_event(struct evl_event *evt,
unwait.efd = evt->active.efd;
pthread_cleanup_push(unwait_event, &unwait);
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &old_type);
ret = oob_ioctl(evt->active.efd, EVL_MONIOC_WAIT, &req);
pthread_setcanceltype(old_type, NULL);
pthread_cleanup_pop(0);
/*

View File

@ -152,8 +152,8 @@ int evl_timedwait_flags(struct evl_flags *flg,
{
struct evl_monitor_state *state;
struct evl_monitor_waitreq req;
int mode, ret, cancel_type;
fundle_t current;
int mode, ret;
current = evl_get_current();
if (current == EVL_NO_HANDLE)
@ -182,10 +182,7 @@ int evl_timedwait_flags(struct evl_flags *flg,
req.status = -EINVAL;
req.value = 0;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &cancel_type);
ret = oob_ioctl(flg->active.efd, EVL_MONIOC_WAIT, &req);
pthread_setcanceltype(cancel_type, NULL);
if (ret)
return -errno;

View File

@ -257,7 +257,7 @@ int evl_timedlock_mutex(struct evl_mutex *mutex,
const struct timespec *timeout)
{
struct evl_monitor_lockreq lreq;
int ret, cancel_type;
int ret;
ret = try_lock(mutex);
if (ret != -ENODATA)
@ -265,14 +265,10 @@ int evl_timedlock_mutex(struct evl_mutex *mutex,
lreq.timeout = *timeout;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &cancel_type);
do
ret = oob_ioctl(mutex->active.efd, EVL_MONIOC_ENTER, &lreq);
while (ret && errno == EINTR);
pthread_setcanceltype(cancel_type, NULL);
return ret ? -errno : 0;
}

View File

@ -164,8 +164,8 @@ int evl_timedget_sem(struct evl_sem *sem, const struct timespec *timeout)
{
struct evl_monitor_state *state;
struct evl_monitor_waitreq req;
int mode, ret, cancel_type;
fundle_t current;
int mode, ret;
current = evl_get_current();
if (current == EVL_NO_HANDLE)
@ -192,9 +192,7 @@ int evl_timedget_sem(struct evl_sem *sem, const struct timespec *timeout)
req.status = -EINVAL;
req.value = 0; /* dummy */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, &cancel_type);
ret = oob_ioctl(sem->active.efd, EVL_MONIOC_WAIT, &req);
pthread_setcanceltype(cancel_type, NULL);
return ret ? -errno : req.status;
}