Update ooo320-m1
[ooovba.git] / sal / inc / osl / conditn.h
blob20aab3e434b171cfba63584545da9270616e3849
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: conditn.h,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _OSL_CONDITION_H_
33 #define _OSL_CONDITION_H_
35 #include <osl/time.h>
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
41 typedef void* oslCondition;
43 typedef enum {
44 osl_cond_result_ok, /* successful completion */
45 osl_cond_result_error, /* error occured, check osl_getLastSocketError() for details */
46 osl_cond_result_timeout, /* blocking operation timed out */
47 osl_cond_result_FORCE_EQUAL_SIZE = SAL_MAX_ENUM
48 } oslConditionResult;
50 /** Creates a condition.
51 The condition is in the reset-state.
52 @returns 0 if condition could not be created.
54 oslCondition SAL_CALL osl_createCondition(void);
56 /** Free the memory used by the condition.
57 @param Condition the condition handle.
59 void SAL_CALL osl_destroyCondition(oslCondition Condition);
61 /** Sets condition to True => wait() will not block, check() returns True.
62 NOTE: ALL threads waiting on this condition are unblocked!
63 @param Condition handle to a created condition.
64 @return False if system-call failed.
66 sal_Bool SAL_CALL osl_setCondition(oslCondition Condition);
68 /** Sets condition to False => wait() will block, check() returns False
69 @param Condition handle to a created condition.
70 @return False if system-call failed.
72 sal_Bool SAL_CALL osl_resetCondition(oslCondition Condition);
74 /** Blocks if condition is not set<BR>
75 If condition has been destroyed prematurely, wait() will
76 return with False.
77 @param Condition handle to a created condition.
78 @param pTimeout Tiemout value or NULL for infinite waiting
79 @return False if system-call failed.
81 oslConditionResult SAL_CALL osl_waitCondition(oslCondition Condition, const TimeValue* pTimeout);
83 /** Queries the state of the condition without blocking.
84 @param Condition handle to a created condition.
85 @return True: condition is set. <BR>
86 False: condition is not set. <BR>
88 sal_Bool SAL_CALL osl_checkCondition(oslCondition Condition);
90 #ifdef __cplusplus
92 #endif
94 #endif /* _OSL_CONDITION_H_ */