Skip to content

Commit

Permalink
improve condition_variable documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jmklix committed Oct 14, 2024
1 parent f8c5d8e commit dc1d4be
Showing 1 changed file with 9 additions and 4 deletions.
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

0 comments on commit dc1d4be

Please sign in to comment.