Commit graph

40 commits

Author SHA1 Message Date
Roland Dobai
314c77609e pthread: Transform the units of the stack size to the FreeRTOS domain
Closes https://github.com/espressif/esp-idf/issues/3015
2019-02-27 12:21:23 +01:00
Roland Dobai
37126d3451 Correct Kconfigs according to the coding style 2019-01-29 13:37:01 +01:00
Anurag Kar
f5e8e05282 pthread tests : test case added for detach functionality 2018-12-28 14:41:24 +05:30
Anurag Kar
d816578e3a bugfix/pthread : pthread_detach implementation fixed to correctly delete pthread object when invoked after task completion 2018-12-27 18:47:46 +05:30
Ivan Grokhotkov
37975c186d Merge branch 'feature/pthread_name_affinity_config' into 'master'
pthread: make affinity and task name configurable

See merge request idf/esp-idf!3878
2018-12-05 13:46:05 +08:00
Mahavir Jain
907b1a9032 mbedtls: align CMake build with corresponding component.mk 2018-11-29 16:23:06 +05:30
Per Malmberg
71f57931bd #2743 - Implemented ability to core affinity and thread name for pthreads and thus also for std::thread. 2018-11-28 20:43:09 +01:00
Ivan Grokhotkov
6091021e83 unity: separate common and IDF specific functionality
New unity component can be used for testing other applications.
Upstream version of Unity is included as a submodule.
Utilities specific to ESP-IDF unit tests (partitions, leak checking
setup/teardown functions, etc) are kept only in unit-test-app.
Kconfig options are added to allow disabling certain Unity features.
2018-11-19 12:36:31 +08:00
Angus Gratton
38bd836d05 Merge branch 'feature/cmake-unit-test' into 'master'
cmake: add unit tests build support

See merge request idf/esp-idf!3003
2018-10-22 16:29:15 +08:00
Anton Maklakov
92caddb501 pthread: fix a type mismatch warning 2018-10-21 15:11:45 +08:00
Renz Bagaporo
cc774111bf cmake: Add support for test build 2018-10-20 12:07:24 +08:00
Anurag Kar
f27db1f241 pthread : Add support for attributes and few APIs
This introduces the following changes :
    * Implmentation added for pthread attribute related functions :
        * pthread_attr_init
        * pthread_attr_destroy
        * pthread_attr_setdetachstate
        * pthread_attr_getdetachstate
        * pthread_attr_getstacksize
        * pthread_attr_setstacksize
    * pthread_create now supports passing attributes/configs through pthread_attr_t structure
    * pthread_mutex_timedlock added
    * pthread_exit added
    * memory for joinable thread is freed before returning from pthread_join
2018-09-22 02:35:27 +05:30
Renz Christian Bagaporo
d9939cedd9 cmake: make main a component again 2018-09-11 09:44:12 +08:00
Angus Gratton
ff2404a272 Merge branch 'master' into feature/cmake 2018-08-16 17:14:17 +10:00
morris
5c6e1e6e67 pthread: fix esp_pthread.h to compatible with c++
esp_pthread.h is missing the necessary extern "C"{ ... } wrapper to be compatible with C++. The result is link errors when you call its functions from C++ code, because the compiler generates mangled names.

Closes https://github.com/espressif/esp-idf/issues/2121
Closes https://github.com/espressif/esp-idf/issues/2172
2018-07-11 14:21:09 +08:00
Angus Gratton
4667fb2495 cmake: Compatibility fixes from Mahavir 2018-06-06 16:14:03 +10:00
Angus Gratton
1cb5712463 cmake: Add component dependency support
Components should set the COMPONENT_REQUIRES & COMPONENT_PRIVATE_REQUIRES variables to define their
requirements.
2018-04-30 09:59:20 +10:00
Angus Gratton
c671a0c3eb build system: Initial cmake support, work in progress 2018-04-30 09:59:20 +10:00
Mahavir Jain
24ad64bfe4 pthread: implement local storage using pvTaskGetThreadLocalStoragePointer
If static task cleanup option is enabled, then before invoking application
defined `vPortCleanUpTCB` hook, pthread specific cleanup is performed.

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-04-19 18:28:55 +05:30
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