Apache HTTPD
thread_cond.c
Go to the documentation of this file.
1/* Licensed to the Apache Software Foundation (ASF) under one or more
2 * contributor license agreements. See the NOTICE file distributed with
3 * this work for additional information regarding copyright ownership.
4 * The ASF licenses this file to You under the Apache License, Version 2.0
5 * (the "License"); you may not use this file except in compliance with
6 * the License. You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <nks/errno.h>
18
19#include "apr.h"
20#include "apr_private.h"
21#include "apr_general.h"
22#include "apr_strings.h"
23#include "apr_arch_thread_mutex.h"
24#include "apr_arch_thread_cond.h"
25#include "apr_portable.h"
26
28{
30
31 NXCondFree(cond->cond);
32 return APR_SUCCESS;
33}
34
58
60 apr_thread_mutex_t *mutex)
61{
62 if (NXCondWait(cond->cond, mutex->mutex) != 0)
63 return APR_EINTR;
64 return APR_SUCCESS;
65}
66
68 apr_thread_mutex_t *mutex,
70{
71 int rc;
72 if (timeout < 0) {
73 rc = NXCondWait(cond->cond, mutex->mutex);
74 }
75 else {
76 timeout = timeout * 1000 / NXGetSystemTick();
77 rc = NXCondTimedWait(cond->cond, mutex->mutex, timeout);
78 if (rc == NX_ETIMEDOUT) {
79 return APR_TIMEUP;
80 }
81 }
82 if (rc != 0) {
83 return APR_EINTR;
84 }
85 return APR_SUCCESS;
86}
87
89{
90 NXCondSignal(cond->cond);
91 return APR_SUCCESS;
92}
93
95{
96 NXCondBroadcast(cond->cond);
97 return APR_SUCCESS;
98}
99
101{
103 if ((stat = thread_cond_cleanup(cond)) == APR_SUCCESS) {
105 return APR_SUCCESS;
106 }
107 return stat;
108}
109
111
APR Miscellaneous library routines.
APR Portability Routines.
APR Strings library.
static apr_status_t thread_cond_cleanup(void *data)
Definition thread_cond.c:22
#define APR_ENOMEM
Definition apr_errno.h:683
#define APR_TIMEUP
Definition apr_errno.h:450
#define APR_EINTR
Definition apr_errno.h:737
apr_redis_t * rc
Definition apr_redis.h:173
const void apr_status_t(*) apr_status_t(* APR_DECLARE)(void) apr_pool_pre_cleanup_register(apr_pool_t *p
Definition apr_pools.h:646
apr_size_t size
const char int apr_pool_t * pool
Definition apr_cstr.h:84
#define APR_SUCCESS
Definition apr_errno.h:225
int apr_status_t
Definition apr_errno.h:44
void * data
#define APR_POOL_IMPLEMENT_ACCESSOR(type)
Definition apr_pools.h:91
#define apr_pcalloc(p, size)
Definition apr_pools.h:465
apr_int64_t apr_interval_time_t
Definition apr_time.h:55
return NULL
Definition mod_so.c:359
IN ULONG IN INT timeout