libs/libc/pthread, syscall/, and include/sys/syscall.h: Support for pthread_mutex_timedlock() was added recently, however no new system call was added for the API make is usable only in the FLAT build. With a pthread_mutex_timedlock() system call, there is no reason for a pthread_mutex_lock() system call since it is now nothing more than an wrapper around pthread_mutex_timedlock(), passing NULL for the time value. The pthread_mutex_lock() syscall was removed and the pthread_mutex_lock() implemented was moved from /sched/pthread to where it now belows in libs/libc/pthread.

This commit is contained in:
Gregory Nutt
2019-02-25 18:19:13 -06:00
parent 68f8161a45
commit 0951151c33
9 changed files with 124 additions and 72 deletions
+1 -1
View File
@@ -93,7 +93,7 @@
"pthread_kill","pthread.h","!defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD)","int","pthread_t","int"
"pthread_mutex_destroy","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_init","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*","FAR const pthread_mutexattr_t*"
"pthread_mutex_lock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_timedlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*","FAR const struct timespec*"
"pthread_mutex_trylock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_unlock","pthread.h","!defined(CONFIG_DISABLE_PTHREAD)","int","FAR pthread_mutex_t*"
"pthread_mutex_consistent","pthread.h","!defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE)","int","FAR pthread_mutex_t*"
1 _exit unistd.h void int
93 pthread_kill pthread.h !defined(CONFIG_DISABLE_SIGNALS) && !defined(CONFIG_DISABLE_PTHREAD) int pthread_t
94 pthread_mutex_destroy pthread.h !defined(CONFIG_DISABLE_PTHREAD) int FAR pthread_mutex_t*
95 pthread_mutex_init pthread.h !defined(CONFIG_DISABLE_PTHREAD) int FAR pthread_mutex_t*
96 pthread_mutex_lock pthread_mutex_timedlock pthread.h !defined(CONFIG_DISABLE_PTHREAD) int FAR pthread_mutex_t*
97 pthread_mutex_trylock pthread.h !defined(CONFIG_DISABLE_PTHREAD) int FAR pthread_mutex_t*
98 pthread_mutex_unlock pthread.h !defined(CONFIG_DISABLE_PTHREAD) int FAR pthread_mutex_t*
99 pthread_mutex_consistent pthread.h !defined(CONFIG_DISABLE_PTHREAD) && !defined(CONFIG_PTHREAD_MUTEX_UNSAFE) int FAR pthread_mutex_t*
+2 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* syscall/syscall_lookup.h
*
* Copyright (C) 2011, 2013-2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2011, 2013-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -306,7 +306,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(pthread_key_delete, 1, STUB_pthread_key_delete)
SYSCALL_LOOKUP(pthread_mutex_destroy, 1, STUB_pthread_mutex_destroy)
SYSCALL_LOOKUP(pthread_mutex_init, 2, STUB_pthread_mutex_init)
SYSCALL_LOOKUP(pthread_mutex_lock, 1, STUB_pthread_mutex_lock)
SYSCALL_LOOKUP(pthread_mutex_timedlock, 2, STUB_pthread_mutex_timedlock)
SYSCALL_LOOKUP(pthread_mutex_trylock, 1, STUB_pthread_mutex_trylock)
SYSCALL_LOOKUP(pthread_mutex_unlock, 1, STUB_pthread_mutex_unlock)
#ifndef CONFIG_PTHREAD_MUTEX_UNSAFE
+3 -2
View File
@@ -1,7 +1,7 @@
/****************************************************************************
* syscall/syscall_stublookup.c
*
* Copyright (C) 2011-2013, 2015-2018 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2013, 2015-2019 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@@ -311,7 +311,8 @@ uintptr_t STUB_pthread_key_delete(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_destroy(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_init(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_mutex_lock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_timedlock(int nbr, uintptr_t parm1,
uintptr_t parm2);
uintptr_t STUB_pthread_mutex_trylock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_unlock(int nbr, uintptr_t parm1);
uintptr_t STUB_pthread_mutex_consistent(int nbr, uintptr_t parm1);