From 9aaabe5673663b2a79e5b3bf3373746b3414a84f Mon Sep 17 00:00:00 2001 From: Benoit Germain Date: Wed, 26 Feb 2014 16:36:52 +0100 Subject: Fixed some compilation warnings --- CHANGES | 1 + src/lanes.c | 5 +-- src/tools.h | 129 +++++++++++++++++++++++++++++++----------------------------- 3 files changed, 69 insertions(+), 66 deletions(-) diff --git a/CHANGES b/CHANGES index c4c8f92..e3d88f7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ CHANGES: CHANGE 104: BGe 25-Feb-14 + * Bumped version to 3.9.2 * Internal rework: the whole Lanes engine now works "per universe" to allow concurrent Lanes execution in more than one embedded master state * this universe is a full userdata created in the master state, selfdestruct_gc is the __gc for this userdata * most of what was initialized only once is now per-universe diff --git a/src/lanes.c b/src/lanes.c index fdd2ab9..5c869d0 100644 --- a/src/lanes.c +++ b/src/lanes.c @@ -876,7 +876,6 @@ LUAG_FUNC( linda_limit) { struct s_Linda* linda = lua_toLinda( L, 1); int pushed; - bool_t wake_writers = FALSE; // make sure we got 3 arguments: the linda, a key and a limit luaL_argcheck( L, lua_gettop( L) == 3, 2, "wrong number of arguments"); @@ -3211,8 +3210,8 @@ static void EnableCrashingOnCrashes( void) { typedef BOOL (WINAPI* tGetPolicy)( LPDWORD lpFlags); typedef BOOL (WINAPI* tSetPolicy)( DWORD dwFlags); - typedef void (* SignalHandlerPointer)( int); - SignalHandlerPointer previousHandler = signal( SIGABRT, signal_handler); + //typedef void (* SignalHandlerPointer)( int); + /*SignalHandlerPointer previousHandler =*/ signal( SIGABRT, signal_handler); const DWORD EXCEPTION_SWALLOWING = 0x1; HMODULE kernel32 = LoadLibraryA("kernel32.dll"); diff --git a/src/tools.h b/src/tools.h index 1d80309..3152646 100644 --- a/src/tools.h +++ b/src/tools.h @@ -62,6 +62,72 @@ extern char const* debugspew_indent; #define DEBUGSPEW_CODE(_code) #endif // USE_DEBUG_SPEW +// ################################################################################################ + +/* + * Do we want to activate full lane tracking feature? (EXPERIMENTAL) + */ +#define HAVE_LANE_TRACKING 1 + +// ################################################################################################ + +// this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime +typedef struct +{ + volatile int refcount; + void* deep; + // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc + luaG_IdFunction idfunc; +} DEEP_PRELUDE; + +// ################################################################################################ + +// everything regarding the a Lanes universe is stored in that global structure +// held as a full userdata in the master Lua state that required it for the first time +// don't forget to initialize all members in LG_configure() +struct s_Universe +{ + // for verbose errors + bool_t verboseErrors; + + lua_CFunction on_state_create_func; + + struct s_Keepers* keepers; + + // Initialized by 'init_once_LOCKED()': the deep userdata Linda object + // used for timers (each lane will get a proxy to this) + volatile DEEP_PRELUDE* timer_deep; // = NULL + +#if HAVE_LANE_TRACKING + MUTEX_T tracking_cs; + struct s_lane* volatile tracking_first; // will change to TRACKING_END if we want to activate tracking +#endif // HAVE_LANE_TRACKING + + MUTEX_T selfdestruct_cs; + + // require() serialization + MUTEX_T require_cs; + + // Lock for reference counter inc/dec locks (to be initialized by outside code) TODO: get rid of this and use atomics instead! + MUTEX_T deep_lock; + MUTEX_T mtid_lock; + + int last_mt_id; + +#if USE_DEBUG_SPEW + int debugspew_indent_depth; +#endif // USE_DEBUG_SPEW + + struct s_lane* volatile selfdestruct_first; + // After a lane has removed itself from the chain, it still performs some processing. + // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads + int volatile selfdestructing_count; +}; + +struct s_Universe* get_universe( lua_State* L); +extern void* const UNIVERSE_REGKEY; + +// ################################################################################################ #ifdef NDEBUG #define _ASSERT_L(lua,c) /*nothing*/ @@ -102,15 +168,6 @@ void luaG_copy_one_time_settings( struct s_Universe* U, lua_State* L, lua_State* // ################################################################################################ -// this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime -typedef struct -{ - volatile int refcount; - void* deep; - // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc - luaG_IdFunction idfunc; -} DEEP_PRELUDE; - enum eLookupMode { eLM_LaneBody, // send the lane body directly from the source to the destination lane @@ -136,60 +193,6 @@ void call_on_state_create( struct s_Universe* U, lua_State* L, lua_State* from_, // ################################################################################################ -/* - * Do we want to activate full lane tracking feature? (EXPERIMENTAL) - */ -#define HAVE_LANE_TRACKING 1 - -// ################################################################################################ - -// everything regarding the a Lanes universe is stored in that global structure -// held as a full userdata in the master Lua state that required it for the first time -// don't forget to initialize all members in LG_configure() -struct s_Universe -{ - // for verbose errors - bool_t verboseErrors; - - lua_CFunction on_state_create_func; - - struct s_Keepers* keepers; - - // Initialized by 'init_once_LOCKED()': the deep userdata Linda object - // used for timers (each lane will get a proxy to this) - volatile DEEP_PRELUDE* timer_deep; // = NULL - -#if HAVE_LANE_TRACKING - MUTEX_T tracking_cs; - struct s_lane* volatile tracking_first; // will change to TRACKING_END if we want to activate tracking -#endif // HAVE_LANE_TRACKING - - MUTEX_T selfdestruct_cs; - - // require() serialization - MUTEX_T require_cs; - - // Lock for reference counter inc/dec locks (to be initialized by outside code) TODO: get rid of this and use atomics instead! - MUTEX_T deep_lock; - MUTEX_T mtid_lock; - - int last_mt_id; - -#if USE_DEBUG_SPEW - int debugspew_indent_depth; -#endif // USE_DEBUG_SPEW - - struct s_lane* volatile selfdestruct_first; - // After a lane has removed itself from the chain, it still performs some processing. - // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads - int volatile selfdestructing_count; -}; - -struct s_Universe* get_universe( lua_State* L); -extern void* const UNIVERSE_REGKEY; - -// ################################################################################################ - extern char const* const CONFIG_REGKEY; extern char const* const LOOKUP_REGKEY; -- cgit v1.2.3-55-g6feb