aws-c-common icon indicating copy to clipboard operation
aws-c-common copied to clipboard

Fix aws_thread and aws_condition_variable header doc

Open nchong-at-aws opened this issue 5 years ago • 0 comments

  1. In thread.h the doc for aws_thread_clean_up currently reads:
/**
 * Cleans up the thread handle. Either detach or join must be called
 * before calling this function.
 */

But the function itself detaches the thread (if it is currently running). There is no function to detach a thread and calling aws_thread_join before this function makes it a no-op.

In condition_variable.h:

  1. The docs for aws_condition_variable_wait, aws_condition_variable_wait_pred, aws_condition_variable_wait_for, and aws_condition_variable_wait_for_pred should note that the function must be called with the mutex locked by the calling thread otherwise the behavior is undefined.

  2. Additionally, the docs for aws_condition_variable_wait and aws_condition_variable_wait_for should note that spurious wakeups can occur: i.e., the return of the function does not apply anything about the wakeup condition associated with the variable. To avoid this problem the user can use the _pred versions of these functions or re-test the condition explicitly.

nchong-at-aws avatar Jan 23 '20 00:01 nchong-at-aws