From f0b1c6d629464c0a59ac78382d86f434e74c2162 Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 22 Aug 2012 21:36:37 +0200 Subject: lanes version 3.2.0 * keeper internals implemented in C instead of Lua for better performances * fixed arguments checks in linda:limit() and linda:set() --- src/keeper.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'src/keeper.h') diff --git a/src/keeper.h b/src/keeper.h index 6c4c6f9..a0ea8c5 100644 --- a/src/keeper.h +++ b/src/keeper.h @@ -13,7 +13,30 @@ void populate_keepers( lua_State *L); struct s_Keeper *keeper_acquire( const void *ptr); void keeper_release( struct s_Keeper *K); void keeper_toggle_nil_sentinels( lua_State *L, int _val_i, int _nil_to_sentinel); -int keeper_call( lua_State *K, char const *func_name, lua_State *L, void *linda, uint_t starting_index); +#define KEEPER_MODEL_LUA 1 +#define KEEPER_MODEL_C 2 +#define KEEPER_MODEL KEEPER_MODEL_C + +#if KEEPER_MODEL == KEEPER_MODEL_LUA +typedef char const* keeper_api_t; +#define KEEPER_API( _op) #_op +#define PUSH_KEEPER_FUNC( K, _api) lua_getglobal( K, _api) +#elif KEEPER_MODEL == KEEPER_MODEL_C +typedef lua_CFunction keeper_api_t; +#define KEEPER_API( _op) keepercall_ ## _op +#define PUSH_KEEPER_FUNC lua_pushcfunction +// lua_Cfunctions to run inside a keeper state (formerly implemented in Lua) +int keepercall_clear( lua_State* L); +int keepercall_send( lua_State* L); +int keepercall_receive( lua_State* L); +int keepercall_receive_batched( lua_State* L); +int keepercall_limit( lua_State* L); +int keepercall_get( lua_State* L); +int keepercall_set( lua_State* L); +int keepercall_count( lua_State* L); +#endif // KEEPER_MODEL + +int keeper_call( lua_State *K, keeper_api_t _func, lua_State *L, void *linda, uint_t starting_index); #endif // __keeper_h__ \ No newline at end of file -- cgit v1.2.3-55-g6feb