Skip to content
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

improve condition_variable documentation #1157

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions include/aws/common/condition_variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,17 @@ AWS_COMMON_API
int aws_condition_variable_notify_all(struct aws_condition_variable *condition_variable);

/**
* Waits the calling thread on a notification from another thread.
* Waits the calling thread on a notification from another thread. This function must be called with the mutex locked
* by the calling thread otherwise the behavior is undefined. Spurious wakeups can occur and to avoid this causing
* any problems use the _pred version of this function.
*/
AWS_COMMON_API
int aws_condition_variable_wait(struct aws_condition_variable *condition_variable, struct aws_mutex *mutex);

/**
* Waits the calling thread on a notification from another thread. If predicate returns false, the wait is reentered,
* otherwise control returns to the caller.
* otherwise control returns to the caller. This function must be called with the mutex locked by the calling thread
* otherwise the behavior is undefined.
*/
AWS_COMMON_API
int aws_condition_variable_wait_pred(
Expand All @@ -87,7 +90,8 @@ int aws_condition_variable_wait_pred(

/**
* Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in
* nanoseconds.
* nanoseconds. This function must be called with the mutex locked by the calling thread otherwise the behavior is
* undefined. Spurious wakeups can occur and to avoid this causing any problems use the _pred version of this function.
*/
AWS_COMMON_API
int aws_condition_variable_wait_for(
Expand All @@ -97,7 +101,8 @@ int aws_condition_variable_wait_for(

/**
* Waits the calling thread on a notification from another thread. Times out after time_to_wait. time_to_wait is in
* nanoseconds. If predicate returns false, the wait is reentered, otherwise control returns to the caller.
* nanoseconds. If predicate returns false, the wait is reentered, otherwise control returns to the caller. This
* function must be called with the mutex locked by the calling thread otherwise the behavior is undefined.
*/
AWS_COMMON_API
int aws_condition_variable_wait_for_pred(
Expand Down
Loading