From 37c81843b69abe01813652f19b3480afdb1a7669 Mon Sep 17 00:00:00 2001 From: Kevin Day Date: Wed, 14 Apr 2021 12:04:52 -0500 Subject: [PATCH] Update: f_thread_lock_read() should return F_resource_not. The pthread_rwlock_rdlock() 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 | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/level_0/f_thread/c/thread.c b/level_0/f_thread/c/thread.c index be58bd8..5f8c9c1 100644 --- a/level_0/f_thread/c/thread.c +++ b/level_0/f_thread/c/thread.c @@ -1766,6 +1766,7 @@ extern "C" { const int error = pthread_rwlock_rdlock(lock); 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 65003e6..b8acf20 100644 --- a/level_0/f_thread/c/thread.h +++ b/level_0/f_thread/c/thread.h @@ -2398,6 +2398,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. * @@ -2449,7 +2450,7 @@ extern "C" { * F_busy on success, but the lock is already locked. * * F_parameter (with error bit) if a parameter is invalid. - * F_resource_not (with error bit) if max locks is reached. + * 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