-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when calling pthread_cond_signal() function #8
Comments
In pthread programming first you have to initialise the variables in the pthread style, using the initializer for that variable. For conditions, you must do: pthread_cond_t cond = PTHREAD_COND_INITIALIZER; Once variable is initialise you can use it in pthread functions. If you do this somewhere in your code prior to call pthread_cond_signal the mutext will be created once. |
Ok. But then you have to alter pthread_cond_init() function. pthread_cond_wait() can not release the semaphore ! |
Let me to make a review .... |
* pthread_cond_xxx function revised (see #8) * add unit test framework * add test case for pthread_cond_xxx * phtread library minor bugs
Please, take a look at: |
Let me to close this issue. No feedback were provided. |
Inside pthread_cond_signal() is called each time mtx_init().
mtx_init() is created the semaphore in any case:
mutex->sem = xSemaphoreCreateBinary ();
This condition should be avoided:
if ( !mutex-> sem ) mutex->sem = xSemaphoreCreateBinary ();
In addition, all of the objects by malloc () must be reset. Used calloc () or memcpy(0) after malloc().
The text was updated successfully, but these errors were encountered: