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.
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
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>
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.
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>
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 ----