Gregory Nutt
eb344d7260
Fix an assertion noted by Jussi Kivilinna.
...
This was a consequence of the recent robust mutex changes. If robust mutexes are selected, then each mutex that a thread takes is retained in a list in threads TCB. If the thread exits and that list is not empty, then we know that the thread exitted while holding mutexes. And, in that case, each will be marked as inconsistent and the any waiter for the thread is awakened.
For the case of pthread_mutex_trywait(), the mutex was not being added to the list! while not usually a fatal error, this was caught by an assertion when pthread_mutex_unlock() was called: It tried to remove the mutex from the TCB list and it was not there when, of course, it shoule be.
The fix was to add pthread_mutex_trytake() which does sem_trywait() and if successful, does correctly add the mutext to the TCB list. This should eliminated the assertion.
2017-03-29 07:50:40 -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
86ab384d77
Forget to add some files in previous commits
2017-03-26 15:46:19 -06:00
Gregory Nutt
8b23c16b90
pthreads: pthread_mutex_consistent() needs to clear flags.
2017-03-26 14:44:57 -06:00
Gregory Nutt
34c5e1c18f
Minor cleanup from recent changes.
2017-03-26 14:04:07 -06:00
Gregory Nutt
5a69453e16
pthreads: Add some assertions.
2017-03-26 13:54:43 -06:00
Gregory Nutt
fe03ef02c4
when pthread exits or is cancelled, mutexes held by thread are marked inconsistent and the highest priority thread waiting for the mutex is awakened.
2017-03-26 13:37:05 -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
2c37d369ab
pthread: Fix return value of pthread_give/takesemaphore(). Add option to pthread_takesemaphore to ignore EINTR or not.
2017-03-26 11:22:17 -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
5fb85451cb
Update some comments
2017-03-22 08:08:43 -06:00
Gregory Nutt
4dbc0a27c6
pthread_create: g_pthreadname[] is not used if CONFIG_TASK_NAME_SIZE==0.
2017-02-26 18:15:16 -06:00
Gregory Nutt
cb7c5f9921
Implement strings.h macros as inline functions when possible for better C++ compatibility.
2017-02-22 10:20:58 -06:00
Gregory Nutt
d5b1ca14e2
Update README and some comments.
2017-01-02 13:54:07 -06:00
Gregory Nutt
d648f9c8b4
Add task_testcancel()
2016-12-10 16:34:14 -06:00
Gregory Nutt
f132960789
Add task_setcanceltype()
2016-12-10 16:06:14 -06:00
Gregory Nutt
5fb207eb36
Add task_setcancelstate()
2016-12-10 15:16:46 -06:00
Gregory Nutt
698597a838
task_delete() now obeys all cancellation point semantics.
2016-12-10 14:39:19 -06:00
Gregory Nutt
b52e4e5ecd
Move cancellation point definitions to their own header file.
2016-12-10 09:08:26 -06:00
Gregory Nutt
bc3ca25cc7
Cancellation points: Close up some logic to eliminte some race conditions.
2016-12-10 08:36:58 -06:00
Gregory Nutt
e62b3bccd3
pthread_setcanceltype() and pthread_testcancel() do not have to be system calls if cancellation points are not enabled.
2016-12-10 07:40:48 -06:00
Gregory Nutt
a0f567f4a3
Update TODO, cosmetic changes, spelling -- US English spells it canceled and canceling vs cancelled and cancelling. No idea why.
2016-12-09 18:39:40 -06:00
Gregory Nutt
a76e729b0d
Trivial, cosmetic
2016-12-09 17:27:57 -06:00
Gregory Nutt
78cdc9f113
Fix a typo in a debug assertion.
2016-12-09 16:59:10 -06:00
Gregory Nutt
7ee0862e67
Merge remote-tracking branch 'origin/master' into cancelpt
2016-12-09 16:54:15 -06:00
Gregory Nutt
b07964461e
pthread_mutex_destroy(): Fix an error in destorynig a mutex which can occur after a pthread has been canceled while holding the mutex.
2016-12-09 16:53:29 -06:00
Gregory Nutt
7fce8022c6
Finishes all cancellation point logic
2016-12-09 16:50:34 -06:00
Gregory Nutt
d8783a7345
Update Documentation
2016-12-09 14:41:54 -06:00
Gregory Nutt
c9ca97b4b5
cancellation points are basically function. More tested is needed and additional cancellation points must be implemented before this can be merged back to master.
2016-12-09 12:01:18 -06:00
Gregory Nutt
018db84567
Flesh out more cancellation point logic.
2016-12-09 10:31:40 -06:00
Gregory Nutt
d35e589d56
Flesh basic cancellation point support
2016-12-09 09:44:23 -06:00
Gregory Nutt
82a79b9c1b
Add framework for cancellation point support.
2016-12-09 08:13:28 -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
6224e47533
pthread cleanup stack: Replace critical section with sched_lock/unlock(). The cleanup stack modification only needs to have the TCB stationary. The stack is never modified from interrupt level logic
2016-12-08 14:33:02 -06:00
Gregory Nutt
ab43681f15
Update TODO and some comments.
2016-12-08 10:24:40 -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
0d5bd30943
Fix a type in include file name
2016-11-03 12:58:02 -06:00
Gregory Nutt
1da3a5fa61
sched: Disable priority inheritance on all semaphores used for signaling
2016-11-03 12:42:02 -06:00
Gregory Nutt
d5b4d848d3
Move protoypes for the non-standard include/semaphore.h file to the non-standard include/nuttx/semaphore.h with the other non-standard semaphore interfaces.
2016-11-02 14:43:03 -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
8669183852
sched/pthread and task: When a pthread is started, there is a small bit of logic that will run on the thread of execution of the new pthread. In the case where the new pthread has a lower priority than the parent thread, then this could cause both the parent thread and the new pthread to be blocked at the priority of the lower priority pthread (assuming that CONFIG_PRIORITY_INHERITANCE is not selected).
...
This change temporarily boosts the priority of the new pthread to at least the priority of the new pthread to at least the priority of the parent thread. When that bit of logic has executed on the thread of execution of the new pthread, it will then drop to the correct priority (if necessary) before calling into the new pthread's entry point.
2016-10-01 11:38:22 -06:00
Gregory Nutt
18ce4ff57b
sched/: Review and correct some stylistic inconsistencies
2016-08-07 08:25:30 -06:00
Gregory Nutt
830af912a1
Add sig_raise()
2016-07-04 09:32:36 -06:00
Gregory Nutt
f3ec664f63
Debug output level (error, warning, info) is now selectable on a per-subsystem, per-driver basis
2016-06-12 13:08:23 -06:00
Gregory Nutt
13cac3b592
sched/: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition.
2016-06-11 16:42:42 -06:00
Gregory Nutt
a1469a3e95
Add CONFIG_DEBUG_ERROR. Change names of *dbg() * *err()
2016-06-11 15:50:49 -06:00