diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-19 13:47:57 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2017-10-24 10:19:05 +0200 |
commit | c31058947491ca319c901040219be39e4f8155b6 (patch) | |
tree | 435bf0887bd77e3d344b31275853a6e52fca8dd8 /cpukit/posix/src/mutextrylock.c | |
parent | score: Rename function threadq support function (diff) | |
download | rtems-c31058947491ca319c901040219be39e4f8155b6.tar.bz2 |
score: Move thread queue timeout handling
Update #3117.
Update #3182.
Diffstat (limited to '')
-rw-r--r-- | cpukit/posix/src/mutextrylock.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/cpukit/posix/src/mutextrylock.c b/cpukit/posix/src/mutextrylock.c index d029ae5de6..895f38fa44 100644 --- a/cpukit/posix/src/mutextrylock.c +++ b/cpukit/posix/src/mutextrylock.c @@ -18,14 +18,7 @@ #include "config.h" #endif -#include <errno.h> -#include <pthread.h> - -#include <rtems/system.h> -#include <rtems/score/coremuteximpl.h> -#include <rtems/score/watchdog.h> #include <rtems/posix/muteximpl.h> -#include <rtems/posix/priorityimpl.h> /** * 11.3.3 Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93 @@ -36,8 +29,17 @@ int pthread_mutex_trylock( pthread_mutex_t *mutex ) { - int r = _POSIX_Mutex_Lock_support( mutex, false, WATCHDOG_NO_TIMEOUT ); - if ( r == EDEADLK ) - r = EBUSY; - return r; + int eno; + + eno = _POSIX_Mutex_Lock_support( + mutex, + (const struct timespec *) POSIX_MUTEX_ABSTIME_TRY_LOCK, + NULL + ); + + if ( eno == EDEADLK ) { + eno = EBUSY; + } + + return eno; } |