Eneboo - Documentación para desarrolladores
src/libmysql_macosx/include/my_semaphore.h
Ir a la documentación de este archivo.
00001 /*
00002  * Module: semaphore.h
00003  *
00004  * Purpose:
00005  *      Semaphores aren't actually part of the PThreads standard.
00006  *      They are defined by the POSIX Standard:
00007  *
00008  *              POSIX 1003.1b-1993      (POSIX.1b)
00009  *
00010  * Pthreads-win32 - POSIX Threads Library for Win32
00011  * Copyright (C) 1998
00012  *
00013  * This library is free software; you can redistribute it and/or
00014  * modify it under the terms of the GNU Library General Public
00015  * License as published by the Free Software Foundation; either
00016  * version 2 of the License, or (at your option) any later version.
00017  *
00018  * This library is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021  * Library General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU Library General Public
00024  * License along with this library; if not, write to the Free
00025  * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00026  * MA 02111-1307, USA
00027  */
00028 
00029 /* This is hacked by Monty to be included in mysys library */
00030 
00031 #ifndef _my_semaphore_h_
00032 #define _my_semaphore_h_
00033 
00034 #ifdef THREAD
00035 
00036 C_MODE_START
00037 #ifdef HAVE_SEMAPHORE_H
00038 #include <semaphore.h>
00039 #elif !defined(__bsdi__)
00040 #ifdef __WIN__
00041 typedef HANDLE sem_t;
00042 #else
00043 typedef struct {
00044   pthread_mutex_t mutex;
00045   pthread_cond_t  cond;
00046   uint            count;
00047 } sem_t;
00048 #endif /* __WIN__ */
00049 
00050 int sem_init(sem_t * sem, int pshared, unsigned int value);
00051 int sem_destroy(sem_t * sem);
00052 int sem_trywait(sem_t * sem);
00053 int sem_wait(sem_t * sem);
00054 int sem_post(sem_t * sem);
00055 int sem_post_multiple(sem_t * sem, unsigned int count);
00056 int sem_getvalue(sem_t * sem, unsigned int * sval);
00057 
00058 #endif /* !__bsdi__ */
00059 
00060 C_MODE_END
00061 
00062 #endif /* THREAD */
00063 
00064 #endif /* !_my_semaphore_h_ */
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'