feat(pthread): added pthread_condattr* stubs to avoid linker errors

Closes https://github.com/espressif/esp-idf/issues/12171
This commit is contained in:
Jakob Hasse 2023-09-21 17:45:55 +08:00
parent 8545f8595f
commit a937efef1a
2 changed files with 34 additions and 7 deletions

View File

@ -8,12 +8,6 @@
const static char *TAG = "esp32_asio_pthread";
int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
{
ESP_LOGW(TAG, "%s: not yet supported!", __func__);
return 0;
}
int pthread_setcancelstate(int state, int *oldstate)
{
return 0;

View File

@ -175,12 +175,45 @@ int pthread_cond_timedwait(pthread_cond_t *cv, pthread_mutex_t *mut, const struc
return ret;
}
// The following pthread_condattr_* function definitions are placed here to enable builds of code
// that references these functions but does not actively use them.
int pthread_condattr_init(pthread_condattr_t *attr)
{
ESP_LOGV(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
ESP_LOGW(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
return ENOSYS;
}
int pthread_condattr_destroy(pthread_condattr_t *attr)
{
ESP_LOGW(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
return ENOSYS;
}
int pthread_condattr_getpshared(const pthread_condattr_t *restrict attr, int *restrict pshared)
{
ESP_LOGW(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
return ENOSYS;
}
int pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared)
{
ESP_LOGW(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
return ENOSYS;
}
int pthread_condattr_getclock(const pthread_condattr_t *restrict attr, clockid_t *restrict clock_id)
{
ESP_LOGW(TAG, "%s not yet implemented (%p)", __FUNCTION__, attr);
return ENOSYS;
}
int pthread_condattr_setclock(pthread_condattr_t *attr, clockid_t clock_id)
{
ESP_LOGW(TAG, "%s: not yet supported!", __func__);
return 0; // moved here from newlib, where it was 0 instead of ENOSYS
}
int pthread_cond_init(pthread_cond_t *cv, const pthread_condattr_t *att)
{
(void) att; /* Unused argument as of now */