Commit Graph

121 Commits

Author SHA1 Message Date
Kedar Sovani
7a0cab0a5b pthread: Allow configuration of priority and stacksize
The expected usage is:
  esp_pthread_set_cfg(cfg);
  pthread_create()

If the inherit flag is set, then all subsequent threads forked by this
thread will also inherit this configuration. This avoids having to
change/prefix this for each and every pthread_create() call.
2018-03-20 18:06:32 +05:30
Mahavir Jain
48e8171114 pthread: fix pthread_once behavior, if mux (handle) is in external PSRAM
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-02-23 14:51:05 +05:30
Per Malmberg
f2370b2830 Removed logging from pthread conditional variable which completely drowned out any other logging and also had negative effects on the RMT due to sharing the same log system. Related to #1345 / TW#16842 2017-12-28 15:21:00 +01:00
Angus Gratton
89407a5770 pthread: Use spinlock not semaphore mutex to protect TLS key list 2017-12-01 14:28:07 +11:00
Amey Inamdar
edb2400742 pthread: Added support for pthread condition variables
This is required for std::condition_variable support

Signed-off-by: Amey Inamdar <amey.inamdar@gmail.com>
2017-11-23 11:26:51 +08:00
Alexey Gerenkov
7ce945a9de pthread: Fixes memory leaks and stack overflow in tests
Also this commit replaces FreeRTOS list used for pthread internals
with simple one from rom/queue.h
2017-11-17 16:57:33 +03:00
Mahavir Jain
158ecdcfd5 pthread: Fix pthread_once to use atomic compare and set
Earlier recursive mutex was being used for this but since
SCOMPARE1 is already being saved/restored during context
switch, atomic compare and set can be used for this.

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2017-11-07 14:28:43 +05:30
Kedar Sovani
07992b08e8 [pthread] Perform init_routine execution outside of the mutex
The mutex is common across all the threads. It needn't be held across
the init_routine() call as long as the 'once' behaviour is guaranteed

Saw a deadlock case, where init_routine of one thread was waiting for
the completion of init_routine in another thread.

t2: wait for command
t1: pthread_once:
         lock once_mux
         init_routine:
               inform thread t2
               wait for signal from t2
t2: received command
         pthread_once
             lock once_mux (already held by t1)
---- Deadlock ----
2017-10-25 13:57:39 +05:30
Angus Gratton
3f4c8f7174 pthreads local storage: add test for unique keys 2017-10-17 15:29:25 +08:00
Angus Gratton
69e92ee320 unit tests: If heap tracing is enabled in sdkconfig, leak trace each test 2017-10-17 15:29:25 +08:00
Angus Gratton
86c89ff169 pthread: Add support for pthread thread local storage
Refactors LWIP to use this for the LWIP thread local semaphore
2017-10-17 14:46:08 +08:00
Alexey Gerenkov
5795ccc806 freertos: Fixes deadlock in pthread_once for init_routines calling pthread_once 2017-10-01 19:52:48 +03:00
Alexey Gerenkov
54a529f596 freertos: Fixes hangup upon pthread_join on finished thread 2017-10-01 19:52:48 +03:00
Alexey Gerenkov
5dea0fca15 esp_pthread_init constructor attr was removed 2017-09-06 10:30:23 +08:00
Alexey Gerenkov
5094965e98 According to comments 2017-09-06 10:30:23 +08:00
Ivan Grokhotkov
e3b86e7bdb pthread: handle statically initialized mutexes 2017-09-06 10:30:23 +08:00
Alexey Gerenkov
20942421c3 According to review comments 2017-09-06 10:30:23 +08:00
Alexey Gerenkov
8859dab10c Cleanup 2017-09-06 10:30:23 +08:00
Alexey Gerenkov
bf8ff8c98b 1) Thread detach functionality added
2) Recursive mutexes support
3) C++ test updated
2017-09-06 10:30:23 +08:00
Alexey Gerenkov
c631c6b358 1) Mux API was added
2) C++ test for threading and mux functions
2017-09-06 10:30:23 +08:00
Alexey Gerenkov
0b09c7006d pthread: Initial version of thread API 2017-09-06 10:30:23 +08:00