mySQL 5.0.11 sources for tomato
[tomato.git] / release / src / router / mysql / storage / ndb / include / portlib / NdbCondition.h
blob81d7d6ca50a1aa8c1d3a46dd8362d99305929b74
1 /* Copyright (c) 2003-2005 MySQL AB
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; version 2 of the License.
7 This program is distributed in the hope that it will be useful,
8 but WITHOUT ANY WARRANTY; without even the implied warranty of
9 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 GNU General Public License for more details.
12 You should have received a copy of the GNU General Public License
13 along with this program; if not, write to the Free Software
14 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */
16 #ifndef NDB_CONDITION_H
17 #define NDB_CONDITION_H
19 #include "NdbMutex.h"
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
25 struct NdbCondition;
28 /**
29 * Create a condition
31 * returnvalue: pointer to the condition structure
33 struct NdbCondition* NdbCondition_Create(void);
35 /**
36 * Wait for a condition, allows a thread to wait for
37 * a condition and atomically releases the associated mutex.
39 * p_cond: pointer to the condition structure
40 * p_mutex: pointer to the mutex structure
41 * returnvalue: 0 = succeeded, 1 = failed
43 int NdbCondition_Wait(struct NdbCondition* p_cond,
44 NdbMutex* p_mutex);
47 * Wait for a condition with timeout, allows a thread to
48 * wait for a condition and atomically releases the associated mutex.
50 * @param p_cond - pointer to the condition structure
51 * @param p_mutex - pointer to the mutex structure
52 * @param msec - Wait for msec milli seconds the most
53 * @return 0 = succeeded, 1 = failed
54 * @
56 int
57 NdbCondition_WaitTimeout(struct NdbCondition* p_cond,
58 NdbMutex* p_mutex,
59 int msec);
62 /**
63 * Signal a condition
65 * p_cond: pointer to the condition structure
66 * returnvalue: 0 = succeeded, 1 = failed
68 int NdbCondition_Signal(struct NdbCondition* p_cond);
71 /**
72 * Broadcast a condition
74 * p_cond: pointer to the condition structure
75 * returnvalue: 0 = succeeded, 1 = failed
77 int NdbCondition_Broadcast(struct NdbCondition* p_cond);
79 /**
80 * Destroy a condition
82 * p_cond: pointer to the condition structure
83 * returnvalue: 0 = succeeded, 1 = failed
85 int NdbCondition_Destroy(struct NdbCondition* p_cond);
87 #ifdef __cplusplus
89 #endif
91 #endif