aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c
diff options
context:
space:
mode:
authororivej <orivej@yandex-team.ru>2022-02-10 16:44:49 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:44:49 +0300
commit718c552901d703c502ccbefdfc3c9028d608b947 (patch)
tree46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c
parente9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff)
downloadydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c')
-rw-r--r--contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c b/contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c
index ca321c6bfa..b45fc7382d 100644
--- a/contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c
+++ b/contrib/restricted/aws/aws-c-common/source/posix/condition_variable.c
@@ -1,6 +1,6 @@
-/**
- * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
- * SPDX-License-Identifier: Apache-2.0.
+/**
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/common/condition_variable.h>
@@ -22,30 +22,30 @@ static int process_error_code(int err) {
}
int aws_condition_variable_init(struct aws_condition_variable *condition_variable) {
- AWS_PRECONDITION(condition_variable);
-
+ AWS_PRECONDITION(condition_variable);
+
if (pthread_cond_init(&condition_variable->condition_handle, NULL)) {
- AWS_ZERO_STRUCT(*condition_variable);
+ AWS_ZERO_STRUCT(*condition_variable);
return aws_raise_error(AWS_ERROR_COND_VARIABLE_INIT_FAILED);
}
- condition_variable->initialized = true;
+ condition_variable->initialized = true;
return AWS_OP_SUCCESS;
}
void aws_condition_variable_clean_up(struct aws_condition_variable *condition_variable) {
- AWS_PRECONDITION(condition_variable);
-
- if (condition_variable->initialized) {
- pthread_cond_destroy(&condition_variable->condition_handle);
- }
-
- AWS_ZERO_STRUCT(*condition_variable);
+ AWS_PRECONDITION(condition_variable);
+
+ if (condition_variable->initialized) {
+ pthread_cond_destroy(&condition_variable->condition_handle);
+ }
+
+ AWS_ZERO_STRUCT(*condition_variable);
}
int aws_condition_variable_notify_one(struct aws_condition_variable *condition_variable) {
- AWS_PRECONDITION(condition_variable && condition_variable->initialized);
-
+ AWS_PRECONDITION(condition_variable && condition_variable->initialized);
+
int err_code = pthread_cond_signal(&condition_variable->condition_handle);
if (err_code) {
@@ -56,8 +56,8 @@ int aws_condition_variable_notify_one(struct aws_condition_variable *condition_v
}
int aws_condition_variable_notify_all(struct aws_condition_variable *condition_variable) {
- AWS_PRECONDITION(condition_variable && condition_variable->initialized);
-
+ AWS_PRECONDITION(condition_variable && condition_variable->initialized);
+
int err_code = pthread_cond_broadcast(&condition_variable->condition_handle);
if (err_code) {
@@ -68,9 +68,9 @@ int aws_condition_variable_notify_all(struct aws_condition_variable *condition_v
}
int aws_condition_variable_wait(struct aws_condition_variable *condition_variable, struct aws_mutex *mutex) {
- AWS_PRECONDITION(condition_variable && condition_variable->initialized);
- AWS_PRECONDITION(mutex && mutex->initialized);
-
+ AWS_PRECONDITION(condition_variable && condition_variable->initialized);
+ AWS_PRECONDITION(mutex && mutex->initialized);
+
int err_code = pthread_cond_wait(&condition_variable->condition_handle, &mutex->mutex_handle);
if (err_code) {
@@ -85,9 +85,9 @@ int aws_condition_variable_wait_for(
struct aws_mutex *mutex,
int64_t time_to_wait) {
- AWS_PRECONDITION(condition_variable && condition_variable->initialized);
- AWS_PRECONDITION(mutex && mutex->initialized);
-
+ AWS_PRECONDITION(condition_variable && condition_variable->initialized);
+ AWS_PRECONDITION(mutex && mutex->initialized);
+
uint64_t current_sys_time = 0;
if (aws_sys_clock_get_ticks(&current_sys_time)) {
return AWS_OP_ERR;