00001 /***************************************************************************** 00002 00003 Copyright (C) 1995, 2009, Innobase Oy. All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify it under 00006 the terms of the GNU General Public License as published by the Free Software 00007 Foundation; version 2 of the License. 00008 00009 This program is distributed in the hope that it will be useful, but WITHOUT 00010 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00011 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License along with 00014 this program; if not, write to the Free Software Foundation, Inc., 51 Franklin 00015 St, Fifth Floor, Boston, MA 02110-1301 USA 00016 00017 *****************************************************************************/ 00018 00019 /**************************************************/ 00026 #pragma once 00027 #ifndef sync0arr_h 00028 #define sync0arr_h 00029 00030 #include "univ.i" 00031 #include "ut0lst.h" 00032 #include "ut0mem.h" 00033 #include "os0thread.h" 00034 00036 typedef struct sync_cell_struct sync_cell_t; 00038 typedef struct sync_array_struct sync_array_t; 00039 00041 #define SYNC_ARRAY_OS_MUTEX 1 00042 #define SYNC_ARRAY_MUTEX 2 00043 /* @} */ 00044 00045 /*******************************************************************/ 00050 UNIV_INTERN 00051 sync_array_t* 00052 sync_array_create( 00053 /*==============*/ 00054 ulint n_cells, 00056 ulint protection); 00059 /******************************************************************/ 00061 UNIV_INTERN 00062 void 00063 sync_array_free( 00064 /*============*/ 00065 sync_array_t* arr); 00066 /******************************************************************/ 00069 UNIV_INTERN 00070 void 00071 sync_array_reserve_cell( 00072 /*====================*/ 00073 sync_array_t* arr, 00074 void* object, 00075 ulint type, 00076 const char* file, 00077 ulint line, 00078 ulint* index); 00079 /******************************************************************/ 00084 UNIV_INTERN 00085 void 00086 sync_array_wait_event( 00087 /*==================*/ 00088 sync_array_t* arr, 00089 ulint index); 00090 /******************************************************************/ 00093 UNIV_INTERN 00094 void 00095 sync_array_free_cell( 00096 /*=================*/ 00097 sync_array_t* arr, 00098 ulint index); 00099 /**********************************************************************/ 00101 UNIV_INTERN 00102 void 00103 sync_array_object_signalled( 00104 /*========================*/ 00105 sync_array_t* arr); 00106 /**********************************************************************/ 00110 UNIV_INTERN 00111 void 00112 sync_arr_wake_threads_if_sema_free(void); 00113 /*====================================*/ 00114 /**********************************************************************/ 00117 UNIV_INTERN 00118 ibool 00119 sync_array_print_long_waits(void); 00120 /*=============================*/ 00121 /********************************************************************/ 00124 UNIV_INTERN 00125 void 00126 sync_array_validate( 00127 /*================*/ 00128 sync_array_t* arr); 00129 /**********************************************************************/ 00131 UNIV_INTERN 00132 void 00133 sync_array_print_info( 00134 /*==================*/ 00135 FILE* file, 00136 sync_array_t* arr); 00139 #ifndef UNIV_NONINL 00140 #include "sync0arr.ic" 00141 #endif 00142 00143 #endif