Huang Qi
c0a0de97ce
Revert "libc: Call pthread_exit in user-space by up_pthread_exit"
...
This reverts commit f4a0b7aedd
.
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2022-02-09 21:21:43 +08:00
Xiang Xiao
4ee5ff81dd
pthread: Add len argument to pthread_getname_np
...
follow the spec:
https://man7.org/linux/man-pages/man3/pthread_setname_np.3.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2022-02-07 08:19:17 +01:00
Xiang Xiao
91f616e824
libc/pthread: Implement pthread_atfork
...
fork isn't supported yet, so the dummy implementation is enough.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-11-22 15:11:48 -03:00
Xiang Xiao
001e7c3e76
sched: Don't include nuttx/sched.h inside sched.h
...
But let nuttx/sched.h include sched.h instead to
avoid expose nuttx kernel API to userspace.
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2021-05-24 12:11:53 +09:00
Huang Qi
f4a0b7aedd
libc: Call pthread_exit in user-space by up_pthread_exit
...
Drop to user-space in kernel/protected build with up_pthread_exit,
now all pthread_cleanup functions executed in user mode.
* A new syscall SYS_pthread_exit added
* A new tcb flag TCB_FLAG_CANCEL_DOING added
* up_pthread_exit implemented for riscv/arm arch
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
2021-05-21 22:46:52 -06:00
Gregory Nutt
bb9b58bdde
libc: Move pthread_create to user space
...
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Change-Id: I5c447d94077debc79158686935f288e4c8e51e01
2021-05-21 22:46:52 -06:00
Alin Jerpelea
9b9be7e1f0
include: Author: Gregory Nutt: update licenses to Apache 2.0
...
Update files from Gregory Nutt to Apache 2.0 license.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2021-02-04 03:33:58 -08:00
chao.an
8b42e6abd2
pthread/spinlock: move the structure prototype out of the definition
...
pthread/pthread_spinlock.c: In function ‘pthread_spin_init’:
pthread/pthread_spinlock.c:114:11: error: dereferencing pointer to incomplete type ‘pthread_spinlock_t’ {aka ‘struct pthread_spinlock_s’}
114 | lock->sp_lock = SP_UNLOCKED;
| ^~
Change-Id: I49dbb2682e36a17bb25a647c6468b7fb511e4a76
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-11-09 18:45:48 -08:00
Xiang Xiao
beb745ef92
sched/pthread: Implement pthread_attr_[get|set]detachstate
...
specified here:
https://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_attr_getdetachstate.html
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I84ec2d14f14cb7118aac3f7f356f83a5f9af4e18
2020-08-20 10:46:14 +01:00
chao.an
7ce2b3fa74
libc/pthread: Implement pthread_condattr_[g|s]etclock
...
Reference:
https: //pubs.opengroup.org/onlinepubs/009695399/functions/pthread_condattr_setclock.html
Change-Id: I19c15d5f219fcf28dbfeb2e5a1e3fc7b38ba2259
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-08-17 19:17:08 +01:00
Xiang Xiao
33ec242caf
Implement proposed POSIX _clockwait variants of existing _timedwait functions
...
Here is the related glibc patchset:
https://patchwork.ozlabs.org/project/glibc/cover/cover.b0c66849a87ca79889a49f2f1f2563b1a8a15d8b.1551291557.git-series.mac@mcrowe.com/
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I0095cb34cef3d0d88a100255053da79266b73ff2
2020-07-27 20:39:59 -03:00
chao.an
3fbdc213b7
syscall/prctl: fix PR_SET_NAME failure if without <pid> arg
...
add PR_SET_NAME_EXT/PR_GET_NAME_EXT extension to avoid semantic
conflicts, use extened version for pthread_setname_np/pthread_getname_np
Change-Id: I40404c737977a623130dcd37feb4061b5526e466
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-07-01 21:52:18 -05:00
chao.an
b83b83bf51
pthread/mutex: add PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP support
...
Note: the _NP suffix indicates a non-portable extension to the POSIX specification.
Library Functions Manual
PTHREAD_MUTEX(3)
...
SYNOPSIS
...
pthread_mutex_t recmutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
...
DESCRIPTION
PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP (for recursive mutexes).
Change-Id: I58320421ee8dc9a90dca4f593b5d3908be3932db
Signed-off-by: chao.an <anchao@xiaomi.com>
2020-06-26 09:52:56 -03:00
Xiang Xiao
a2d924eea4
syscall: Fix typo error in cvs and header file
...
and reoder the entry in cvs file
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-05-07 10:31:05 -06:00
Xiang Xiao
cde88cabcc
Run codespell -w with the latest dictonary again
...
Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
2020-02-23 22:27:46 +01:00
Juha Niskanen
fd462d5ce2
sched/pthread, Documentation: fix pthread_key_delete, pthread_self and pthread_yield documentation and some comments.
2019-10-17 11:04:17 -06:00
Gregory Nutt
dbd1bb1f1e
All function pointer types should be prefaced by the qualifier CODE (unless the callable function is known to reside in RAM, then it should be FAR).
2019-08-26 17:31:29 -06:00
Gregory Nutt
84a57f8fa0
Fix several ZNeo compile issues. There are more. Pthreads: Fix a could of places where FAR was added when it is not appropriate. This matters to ZNeo which depends on definitions of NEAR and FAR points.
2019-06-03 13:06:58 -06:00
Joao Matos
8f5a94c5e5
include/pthread.h and libs/libcpthread: Fixed pthread_attr_get/setstacksize param type to size_t.
2019-04-04 10:33:57 -06:00
Joao Matos
08ff68edec
sched/pthread: Added non-standard pthread_get_stackaddr_np() and pthread_get_stacksize_np().
2019-04-04 10:30:46 -06:00
Gregory Nutt
b2f110e0b0
include/pthread.h and libs/libc/pthread/pthread_spinlock.c: Add a very preliminary implementation of the new POSIX pthread_spinlock_* interfaces. This feature is marked EXPERIMENTAL. There are usage model issues to be examined and there are also architectural issues that currently limit the implemantion to the FLAT build (that is, however, fixable when the APIs are needed.
2019-02-28 10:21:05 -06:00
Gregory Nutt
c7cc6bab96
included/pthreads, sched/pthreads, and Documetions: Updates after review of last PR.
2019-02-24 14:40:11 -06:00
Leif Jakob
58e387fc6f
Merged in leif_jakob/nuttx/pthread_mutex_timedlock (pull request #830 )
...
support for pthread_mutex_timedlock
Approved-by: Gregory Nutt <gnutt@nuttx.org>
2019-02-24 20:04:24 +00:00
Xiang Xiao
43d47a66c5
include/pthread.h and signal.h: Avoid redefinition of types
2019-01-27 11:34:39 -06:00
xuanlin
2c93467436
pthreads: Add support static pthread stack. Add standard pthread_attr_setstack() and pthread_attr_getstack(). In all cases where the stack is released, add check to see which allocator must be used to free the stack: The user or the kernel allocator.
2018-08-23 09:49:20 -06:00
Mark Schulte
35ca733108
pthread.h: Fix rwlock initializer
2017-04-08 12:34:08 -06:00
Gregory Nutt
dea251783a
pthread.h: Remove duplicate, possible erroneous definitino of PTHREAD_MUTEX_INITIALIZER that crept in with some recent changes.
2017-04-08 08:14:11 -06:00
Mark Schulte
2b1ca79b4b
pthread rwlock bugfixes
2017-04-07 15:45:24 -06:00
Gregory Nutt
b631dc886f
Remove CONFIG_PTHREAD_RWLOCK. Rwlock interfaces built unconditionally.
2017-04-07 07:34:22 -06:00
Mark Schulte
7bb26d2615
pthreads: Adding rwlock implementation
...
Adding an implementation for read/write locks into the pthread library.
These locks are writer priority, such that if any writers come in they
are given priority for writing.
2017-04-07 07:03:00 -06:00
Jussi Kivilinna
1879f5127b
Fix PTHREAD_MUTEX_INITIALIZER which was not updated with last mutex changes.
2017-03-28 09:07:32 -06:00
Gregory Nutt
b07d3fc305
Rename CONFIG_MUTEX_TYPES to CONFIG_PTHREAD_MUTEX_TYPES
2017-03-27 09:08:14 -06:00
Gregory Nutt
f2f798cb29
pthread mutexes: Finish logic to support configuration mutex robustness.
2017-03-27 08:50:45 -06:00
Gregory Nutt
666208cf23
pthread mutexes: Add option to support both unsafe and robust mutexes via pthread_mutexattr_get/setrobust().
2017-03-26 18:37:24 -06:00
Gregory Nutt
8b3c554e45
pthreads: Add a configuration option to disable robust mutexes and revert to the traditional unsafe mutexes.
2017-03-26 17:37:28 -06:00
Gregory Nutt
34c5e1c18f
Minor cleanup from recent changes.
2017-03-26 14:04:07 -06:00
Gregory Nutt
6e623ce06f
pthreads: Partial implementation of final part of robust mutexes: Keep list of all mutexes held by a thread in a list in the TCB.
2017-03-26 12:46:57 -06:00
Gregory Nutt
363403fb1f
pthreads: Add more robustness characteristics: pthread_mutex_lock() and trylock() will now return EOWNERDEAD if the mutex is locked by a thread that no longer exists. Add pthread_mutex_consistent() to recover from this situation.
2017-03-26 10:35:23 -06:00
Gregory Nutt
acaae12e8b
Add pthread_testcancel(), pthread_testcancel(), and definitiions for cancellation types.
2016-12-09 07:23:00 -06:00
Gregory Nutt
a1fbc2ad0d
pthreads: Add pthread_cleanup_push() and pthread_cleanup_pop()
2016-12-08 09:27:13 -06:00
Gregory Nutt
796969f6b6
Update TODO. Provide do-nothing stubs for mutex attribute interfaces if features not enabled. pthread_cond includes a signaling semaphore and should call sem_setprotocol.
2016-11-05 11:06:52 -06:00
Gregory Nutt
97bf82ee05
Semaphores: Provide macros for sem_setprotobol() and sem_getprotocol() if priority inheritance is not enabled. More SEM_PRIO_* definitions to include/nuttx/semaphore.h
2016-11-02 18:21:46 -06:00
Gregory Nutt
92d3022411
Add pthread_mutexattr_get/set_protocol and non-standard sem_get/set_protocol. These may use to enable or disable priority inheritance on a single semaphore.
2016-11-02 09:05:18 -06:00
Gregory Nutt
86b79b33cf
Reserver the name 'err' for other purposes
2016-06-11 14:40:07 -06:00
Gregory Nutt
0eadf1dcad
Costmetic change + update submodules
2016-02-20 14:57:05 -06:00
Gregory Nutt
5a590e99b9
Add SYSCALLS for pthread_setaffinity() and pthread_getaffinity()
2016-02-19 18:13:06 -06:00
Gregory Nutt
a633353ec3
Add a CPU affinity set to the TCB if SMP is enable and use this CPU set as a mask for determining which CPUs the thread may run on. Add an affinity field to the attrributes to permit controlling which CPUs a pthread may run on. Implements pthread_att_setaffinity_np() and pthread_attr_getaffinity_np().
2016-02-19 17:33:35 -06:00
Gregory Nutt
72d3920295
Rename cpuset_t to cpu_set_t which is the type used in some non-standard Linux/GNU interfaces. Move definitions of cpu_set_t to include/sys/types.h. Add prototypes for sched_setaffinity(), sched_getaffinity(), pthread_attr_setaffinity_np(), pthread_attr_getaffinity_np(), pthread_setaffinity_np(), and pthread_getaffinity_np(). No implementation is yet in place.
2016-02-19 15:57:07 -06:00
Gregory Nutt
b1938c065d
sys/time.h: Fix timersub macro; time_t is unsigned
2015-12-31 09:05:35 -06:00
Gregory Nutt
c1fff4706c
signals: Adds a very limited, minimal implementation for SIGEV_THREAD
2015-12-30 15:01:14 -06:00