libguac 1.6.0
 
Loading...
Searching...
No Matches
flag.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#ifndef GUAC_FLAG_H
21#define GUAC_FLAG_H
22
23#include "flag-types.h"
24
25#include <pthread.h>
26
27struct guac_flag {
28
34 pthread_mutex_t value_mutex;
35
39 pthread_cond_t value_changed;
40
47 unsigned int value;
48
49};
50
62void guac_flag_init(guac_flag* event_flag);
63
78void guac_flag_destroy(guac_flag* event_flag);
79
98void guac_flag_set(guac_flag* event_flag,
99 unsigned int flags);
100
120void guac_flag_set_and_lock(guac_flag* event_flag,
121 unsigned int flags);
122
142void guac_flag_clear(guac_flag* event_flag,
143 unsigned int flags);
144
165void guac_flag_clear_and_lock(guac_flag* event_flag,
166 unsigned int flags);
167
182void guac_flag_lock(guac_flag* event_flag);
183
196void guac_flag_unlock(guac_flag* event_flag);
197
211void guac_flag_wait_and_lock(guac_flag* event_flag,
212 unsigned int flags);
213
240int guac_flag_timedwait_and_lock(guac_flag* event_flag,
241 unsigned int flags, unsigned int msec_timeout);
242
243#endif
244
Generic integer flag intended for signalling of arbitrary events between processes.
Definition flag.h:27
unsigned int value
The current value of this flag.
Definition flag.h:47
pthread_mutex_t value_mutex
The mutex used to ensure concurrent changes to the value of this flag are threadsafe,...
Definition flag.h:34
pthread_cond_t value_changed
Condition variable that signals when the value of this flag has changed.
Definition flag.h:39