From 71f0a2a47720730818eced0baa3f96a94c7d9bea Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 14 Apr 2021 17:41:18 -0500 Subject: [PATCH] Update: f_thread_lock_read_timed() should return F_resource_not. The pthread_rwlock_timedrdlock() potentially returns EAGAIN. This needs to be handled, translated into F_resource_not (with error bit), and then returned. --- level_0/f_thread/c/thread.c | 1 + level_0/f_thread/c/thread.h | 1 + 2 files changed, 2 insertions(+) diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index 5f8c9c1..1393298 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1788,6 +1788,7 @@ extern "C" { const int error = pthread_rwlock_timedrdlock(lock, timeout); if (error) { + if (error == EAGAIN) return F_status_set_error(F_resource_not); if (error == EDEADLK) return F_status_set_error(F_deadlock); if (error == EINVAL) return F_status_set_error(F_parameter); if (error == ETIMEDOUT) return F_time; diff --git a/level_0/f_thread/c/thread.h b/level_0/f_thread/c/thread.h index b8acf20..0468882 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -2426,6 +2426,7 @@ extern "C" { * * F_deadlock (with error bit) if operation would cause a deadlock. * F_parameter (with error bit) if a parameter is invalid. + * F_resource_not (with error bit) if max number of read locks allowed is reached. * * F_failure (with error bit) on any other error. * -- 1.8.3.1