00001 /***************************************************************************** 00002 00003 Copyright (C) 2006, 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 /*******************************************************************/ 00032 #pragma once 00033 #ifndef IB_WORK_QUEUE_H 00034 #define IB_WORK_QUEUE_H 00035 00036 #include "ut0list.h" 00037 #include "mem0mem.h" 00038 #include "os0sync.h" 00039 #include "sync0types.h" 00040 00041 typedef struct ib_wqueue_struct ib_wqueue_t; 00042 00043 /****************************************************************/ 00046 UNIV_INTERN 00047 ib_wqueue_t* 00048 ib_wqueue_create(void); 00049 /*===================*/ 00050 00051 /****************************************************************/ 00053 UNIV_INTERN 00054 void 00055 ib_wqueue_free( 00056 /*===========*/ 00057 ib_wqueue_t* wq); 00059 /****************************************************************/ 00061 UNIV_INTERN 00062 void 00063 ib_wqueue_add( 00064 /*==========*/ 00065 ib_wqueue_t* wq, 00066 void* item, 00067 mem_heap_t* heap); 00070 /****************************************************************/ 00073 UNIV_INTERN 00074 void* 00075 ib_wqueue_wait( 00076 /*===========*/ 00077 ib_wqueue_t* wq); 00079 /* Work queue. */ 00080 struct ib_wqueue_struct { 00081 mutex_t mutex; 00082 ib_list_t* items; 00083 os_event_t event; 00084 }; 00085 00086 #endif