2011-04-22 14:26:36 -07:00
|
|
|
/* EINA - EFL data type library
|
|
|
|
* Copyright (C) 2011 Vincent Torri
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library;
|
|
|
|
* if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2011-04-24 08:54:09 -07:00
|
|
|
#ifndef EINA_LOCK_H_
|
|
|
|
#define EINA_LOCK_H_
|
2011-04-22 14:26:36 -07:00
|
|
|
|
|
|
|
#include "eina_config.h"
|
2011-05-02 04:25:35 -07:00
|
|
|
#include "eina_types.h"
|
2011-04-22 14:26:36 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @addtogroup Eina_Tools_Group Tools
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup Eina_File_Group File
|
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2011-05-02 04:25:35 -07:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
EINA_LOCK_FAIL = EINA_FALSE,
|
|
|
|
EINA_LOCK_SUCCEED = EINA_TRUE,
|
|
|
|
EINA_LOCK_DEADLOCK
|
|
|
|
} Eina_Lock_Result;
|
|
|
|
|
2011-04-22 14:26:36 -07:00
|
|
|
#ifdef EINA_HAVE_THREADS
|
|
|
|
# ifdef _WIN32_WCE
|
|
|
|
# include "eina_inline_lock_wince.x"
|
2011-04-29 12:08:03 -07:00
|
|
|
# elif defined(_WIN32)
|
2011-04-22 14:26:36 -07:00
|
|
|
# include "eina_inline_lock_win32.x"
|
|
|
|
# else
|
|
|
|
# include "eina_inline_lock_posix.x"
|
|
|
|
# endif
|
|
|
|
#else
|
|
|
|
# include "eina_inline_lock_void.x"
|
|
|
|
#endif
|
|
|
|
|
2011-05-02 06:52:34 -07:00
|
|
|
static inline Eina_Bool eina_lock_new(Eina_Lock *mutex);
|
2011-05-02 04:25:35 -07:00
|
|
|
static inline void eina_lock_free(Eina_Lock *mutex);
|
|
|
|
static inline Eina_Lock_Result eina_lock_take(Eina_Lock *mutex);
|
|
|
|
static inline Eina_Lock_Result eina_lock_take_try(Eina_Lock *mutex);
|
|
|
|
static inline Eina_Lock_Result eina_lock_release(Eina_Lock *mutex);
|
2011-05-04 06:53:22 -07:00
|
|
|
static inline void eina_lock_debug(const Eina_Lock *mutex);
|
2011-05-02 04:25:35 -07:00
|
|
|
|
2011-05-09 03:32:56 -07:00
|
|
|
static inline Eina_Bool eina_condition_new(Eina_Condition *cond, Eina_Lock *mutex);
|
|
|
|
static inline void eina_condition_free(Eina_Condition *cond);
|
|
|
|
static inline Eina_Bool eina_condition_wait(Eina_Condition *cond);
|
2011-05-30 08:24:06 -07:00
|
|
|
static inline Eina_Bool eina_condition_timedwait(Eina_Condition *cond, double t);
|
2011-05-09 03:32:56 -07:00
|
|
|
static inline Eina_Bool eina_condition_broadcast(Eina_Condition *cond);
|
|
|
|
static inline Eina_Bool eina_condition_signal(Eina_Condition *cond);
|
|
|
|
|
2011-04-22 14:26:36 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|