Bump version to 6.4-15
[LibreOffice.git] / include / osl / conditn.h
blob785834bb103f69a1deb79b3107bd4fe898361c43
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_OSL_CONDITN_H
21 #define INCLUDED_OSL_CONDITN_H
23 #include "sal/config.h"
25 #include "osl/time.h"
26 #include "sal/saldllapi.h"
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
32 typedef void* oslCondition;
34 typedef enum {
35 osl_cond_result_ok, /*<! Successful completion. */
36 osl_cond_result_error, /*<! Error occurred. @see osl_getLastSocketError() */
37 osl_cond_result_timeout, /*<! Blocking operation timed out. */
38 osl_cond_result_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
39 } oslConditionResult;
41 /** Creates a condition.
43 @deprecated use C++11's std::condition_variable instead
44 for a more robust and helpful condition.
46 The condition is in the reset-state.
48 @retval osl_cond_result_error Condition could not be created.
50 SAL_DLLPUBLIC oslCondition SAL_CALL osl_createCondition(void);
52 /** Free the memory used by the condition.
54 @param Condition the condition handle.
56 SAL_DLLPUBLIC void SAL_CALL osl_destroyCondition(oslCondition Condition);
58 /** Sets condition to True => wait() will not block, check() returns True.
60 @attention @em all threads waiting on this condition are unblocked!
62 @param Condition handle to a created condition.
63 @retval False if system-call failed.
65 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_setCondition(oslCondition Condition);
67 /** Sets condition to False => wait() will block, check() returns False
69 @param Condition handle to a created condition.
70 @retval False if system-call failed.
72 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition);
74 /** Blocks if condition is not set.
76 @param Condition handle to a created condition.
77 @param pTimeout Timeout value or NULL for infinite waiting
78 @retval False Condition has been destroyed prematurely or system call has failed.
80 SAL_DLLPUBLIC oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const TimeValue* pTimeout);
82 /** Queries the state of the condition without blocking.
84 @param Condition handle to a created condition.
86 @retval True condition is set
87 @retval False condition is not set
89 SAL_DLLPUBLIC sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition);
91 #ifdef __cplusplus
93 #endif
95 #endif // INCLUDED_OSL_CONDITN_H
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */