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