1 #include <pthread.h>
2 #include "esp_log.h"
3 
4 const static char *TAG = "esp32_asio_pthread";
5 
pthread_condattr_setclock(pthread_condattr_t * attr,clockid_t clock_id)6 int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
7 {
8     ESP_LOGW(TAG, "%s: not yet supported!", __func__);
9     return 0;
10 }
11 
pthread_setcancelstate(int state,int * oldstate)12 int pthread_setcancelstate(int state, int *oldstate)
13 {
14     return 0;
15 }
16 
17 //  This functions (pthread_sigmask(), sigfillset) are called from ASIO::signal_blocker to temporarily silence signals
18 //  Since signals are not yet supported in ESP pthread these functions serve as no-ops
19 //
pthread_sigmask(int how,const sigset_t * restrict set,sigset_t * restrict oset)20 int pthread_sigmask(int how, const sigset_t *restrict set, sigset_t *restrict oset)
21 {
22     ESP_LOGD(TAG, "%s: Signals not supported in ESP pthread", __func__);
23     return 0;
24 }
25 
sigfillset(sigset_t * what)26 int sigfillset(sigset_t *what)
27 {
28     ESP_LOGD(TAG, "%s: Signals not supported in ESP pthread", __func__);
29     if (what != NULL) {
30         *what = ~0;
31     }
32     return 0;
33 }
34 
newlib_include_pthread_impl(void)35 void newlib_include_pthread_impl(void)
36 {
37     // Linker hook, exists for no other purpose
38 }
39