LibreOffice LibreOffice 4.1 SDK C/C++ API Reference

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
conditn.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20 #ifndef _OSL_CONDITN_HXX_
21 #define _OSL_CONDITN_HXX_
22
23 #ifdef __cplusplus
24
25 #include <osl/time.h>
26
27 #include <osl/conditn.h>
28
29
30 namespace osl
31 {
32
33 class Condition
34 {
35 public:
36
37 enum Result
38 {
39 result_ok = osl_cond_result_ok,
40 result_error = osl_cond_result_error,
41 result_timeout = osl_cond_result_timeout
42 };
43
44 /* Create a condition.
45 */
46 Condition()
47 {
48 condition = osl_createCondition();
49 }
50
51 /* Release the OS-structures and free condition data-structure.
52 */
53 ~Condition()
54 {
55 osl_destroyCondition(condition);
56 }
57
58 /* Release all waiting threads, check returns sal_True.
59 */
60 void set()
61 {
62 osl_setCondition(condition);
63 }
64
65 /* Reset condition to false: wait() will block, check() returns sal_False.
66 */
67 void reset() {
68 osl_resetCondition(condition);
69 }
70
73 Result wait(const TimeValue *pTimeout = 0)
74 {
75 return (Result) osl_waitCondition(condition, pTimeout);
76 }
77
80 sal_Bool check()
81 {
82 return osl_checkCondition(condition);
83 }
84
85
86 private:
87 oslCondition condition;
88
95 Condition(const Condition&);
96
103 Condition(oslCondition condition);
104
108 Condition& operator= (const Condition&);
109
113 Condition& operator= (oslCondition);
114 };
115
116 }
117
118 #endif /* __cplusplus */
119 #endif /* _OSL_CONDITN_HXX_ */
120
121 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
osl::Condition::result_error
Definition: conditn.hxx:40
osl::Condition::Result
Result
Definition: conditn.hxx:37
TimeValue
Definition: time.h:42
osl_destroyCondition
SAL_DLLPUBLIC void osl_destroyCondition(oslCondition Condition)
Free the memory used by the condition.
osl_setCondition
SAL_DLLPUBLIC sal_Bool osl_setCondition(oslCondition Condition)
Sets condition to True => wait() will not block, check() returns True.
osl::Condition::reset
void reset()
Definition: conditn.hxx:67
osl_cond_result_error
Definition: conditn.h:37
osl::Condition::check
sal_Bool check()
Checks if the condition is set without blocking.
Definition: conditn.hxx:80
conditn.h
osl_checkCondition
SAL_DLLPUBLIC sal_Bool osl_checkCondition(oslCondition Condition)
Queries the state of the condition without blocking.
osl::Condition::set
void set()
Definition: conditn.hxx:60
osl::Condition::wait
Result wait(const TimeValue *pTimeout=0)
Blocks the calling thread until condition is set.
Definition: conditn.hxx:73
osl_resetCondition
SAL_DLLPUBLIC sal_Bool osl_resetCondition(oslCondition Condition)
Sets condition to False => wait() will block, check() returns False.
osl_cond_result_timeout
Definition: conditn.h:38
osl::Condition::result_ok
Definition: conditn.hxx:39
osl::Condition::result_timeout
Definition: conditn.hxx:41
osl::Condition::Condition
Condition()
Definition: conditn.hxx:46
osl_createCondition
SAL_DLLPUBLIC oslCondition osl_createCondition(void)
Creates a condition.
time.h
osl::Condition::~Condition
~Condition()
Definition: conditn.hxx:53
sal_Bool
unsigned char sal_Bool
Definition: types.h:37
osl_waitCondition
SAL_DLLPUBLIC oslConditionResult osl_waitCondition(oslCondition Condition, const TimeValue *pTimeout)
Blocks if condition is not set If condition has been destroyed prematurely, wait() will return with ...
osl::Condition
Definition: conditn.hxx:33
osl_cond_result_ok
Definition: conditn.h:36
oslCondition
void * oslCondition
Definition: conditn.h:33