os/graphics/graphicscomposition/openwfcompositionengine/adaptation/include/owfcond.h
First public contribution.
2 /* Copyright (c) 2009 The Khronos Group Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and/or associated documentation files (the
6 * "Materials"), to deal in the Materials without restriction, including
7 * without limitation the rights to use, copy, modify, merge, publish,
8 * distribute, sublicense, and/or sell copies of the Materials, and to
9 * permit persons to whom the Materials are furnished to do so, subject to
10 * the following conditions:
12 * The above copyright notice and this permission notice shall be included
13 * in all copies or substantial portions of the Materials.
15 * THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
19 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
20 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
21 * MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
36 typedef void* OWF_COND;
38 /*! \brief Initialize a condition variable
41 * \param mutex mutex to be used when wait is called
43 * \return true or false depending whether initialization
46 OWF_API_CALL OWFboolean
47 OWF_Cond_Init(OWF_COND* cond, OWF_MUTEX mutex);
49 /*! \brief Destroy a condition variable
54 OWF_Cond_Destroy(OWF_COND* cond);
56 /*! \brief Block on a condition variable
59 * \param timeout maximum time to wait in nanoseconds
61 * Cond must be initialized with OWF_Cond_Init. Caller MUST hold
62 * the mutex specified upon initialization. Call will block on
63 * the cond and release mutex until cond is signalled. After cond
64 * is signalled the mutex is regained.
66 * The call will not block if timeout equals to zero. If timeout is
67 * greater than zero, the call will not return until 'timeout'
68 * nanoseconds has elapsed or cond is signalled. It timeout equal to
69 * OWF_FOREVER, the call returns only after cond is signalled.
71 OWF_API_CALL OWFboolean
72 OWF_Cond_Wait(OWF_COND cond, OWFtime timeout);
74 /*! \brief Signal a condition variable
78 * Only one of waiters for cond will be woke-up
80 OWF_API_CALL OWFboolean
81 OWF_Cond_Signal(OWF_COND cond);
83 /*! \brief Signal a condition variable
87 * Wake-up all waiters of cond.
89 OWF_API_CALL OWFboolean
90 OWF_Cond_SignalAll(OWF_COND cond);
99 #endif /* OWFCOND_H_ */