diff options
| author | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-26 16:36:52 +0100 |
|---|---|---|
| committer | Benoit Germain <bnt period germain arrobase gmail period com> | 2014-02-26 16:36:52 +0100 |
| commit | 9aaabe5673663b2a79e5b3bf3373746b3414a84f (patch) | |
| tree | e89c6a6857a1a6c579b2990db0a02c2c20203b96 | |
| parent | fe3c44e63f99538a02d42d2504ba405a6977ec0a (diff) | |
| download | lanes-9aaabe5673663b2a79e5b3bf3373746b3414a84f.tar.gz lanes-9aaabe5673663b2a79e5b3bf3373746b3414a84f.tar.bz2 lanes-9aaabe5673663b2a79e5b3bf3373746b3414a84f.zip | |
Fixed some compilation warnings
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | src/lanes.c | 5 | ||||
| -rw-r--r-- | src/tools.h | 129 |
3 files changed, 69 insertions, 66 deletions
| @@ -1,6 +1,7 @@ | |||
| 1 | CHANGES: | 1 | CHANGES: |
| 2 | 2 | ||
| 3 | CHANGE 104: BGe 25-Feb-14 | 3 | CHANGE 104: BGe 25-Feb-14 |
| 4 | * Bumped version to 3.9.2 | ||
| 4 | * Internal rework: the whole Lanes engine now works "per universe" to allow concurrent Lanes execution in more than one embedded master state | 5 | * Internal rework: the whole Lanes engine now works "per universe" to allow concurrent Lanes execution in more than one embedded master state |
| 5 | * this universe is a full userdata created in the master state, selfdestruct_gc is the __gc for this userdata | 6 | * this universe is a full userdata created in the master state, selfdestruct_gc is the __gc for this userdata |
| 6 | * most of what was initialized only once is now per-universe | 7 | * 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) | |||
| 876 | { | 876 | { |
| 877 | struct s_Linda* linda = lua_toLinda( L, 1); | 877 | struct s_Linda* linda = lua_toLinda( L, 1); |
| 878 | int pushed; | 878 | int pushed; |
| 879 | bool_t wake_writers = FALSE; | ||
| 880 | 879 | ||
| 881 | // make sure we got 3 arguments: the linda, a key and a limit | 880 | // make sure we got 3 arguments: the linda, a key and a limit |
| 882 | luaL_argcheck( L, lua_gettop( L) == 3, 2, "wrong number of arguments"); | 881 | luaL_argcheck( L, lua_gettop( L) == 3, 2, "wrong number of arguments"); |
| @@ -3211,8 +3210,8 @@ static void EnableCrashingOnCrashes( void) | |||
| 3211 | { | 3210 | { |
| 3212 | typedef BOOL (WINAPI* tGetPolicy)( LPDWORD lpFlags); | 3211 | typedef BOOL (WINAPI* tGetPolicy)( LPDWORD lpFlags); |
| 3213 | typedef BOOL (WINAPI* tSetPolicy)( DWORD dwFlags); | 3212 | typedef BOOL (WINAPI* tSetPolicy)( DWORD dwFlags); |
| 3214 | typedef void (* SignalHandlerPointer)( int); | 3213 | //typedef void (* SignalHandlerPointer)( int); |
| 3215 | SignalHandlerPointer previousHandler = signal( SIGABRT, signal_handler); | 3214 | /*SignalHandlerPointer previousHandler =*/ signal( SIGABRT, signal_handler); |
| 3216 | const DWORD EXCEPTION_SWALLOWING = 0x1; | 3215 | const DWORD EXCEPTION_SWALLOWING = 0x1; |
| 3217 | 3216 | ||
| 3218 | HMODULE kernel32 = LoadLibraryA("kernel32.dll"); | 3217 | 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; | |||
| 62 | #define DEBUGSPEW_CODE(_code) | 62 | #define DEBUGSPEW_CODE(_code) |
| 63 | #endif // USE_DEBUG_SPEW | 63 | #endif // USE_DEBUG_SPEW |
| 64 | 64 | ||
| 65 | // ################################################################################################ | ||
| 66 | |||
| 67 | /* | ||
| 68 | * Do we want to activate full lane tracking feature? (EXPERIMENTAL) | ||
| 69 | */ | ||
| 70 | #define HAVE_LANE_TRACKING 1 | ||
| 71 | |||
| 72 | // ################################################################################################ | ||
| 73 | |||
| 74 | // this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime | ||
| 75 | typedef struct | ||
| 76 | { | ||
| 77 | volatile int refcount; | ||
| 78 | void* deep; | ||
| 79 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | ||
| 80 | luaG_IdFunction idfunc; | ||
| 81 | } DEEP_PRELUDE; | ||
| 82 | |||
| 83 | // ################################################################################################ | ||
| 84 | |||
| 85 | // everything regarding the a Lanes universe is stored in that global structure | ||
| 86 | // held as a full userdata in the master Lua state that required it for the first time | ||
| 87 | // don't forget to initialize all members in LG_configure() | ||
| 88 | struct s_Universe | ||
| 89 | { | ||
| 90 | // for verbose errors | ||
| 91 | bool_t verboseErrors; | ||
| 92 | |||
| 93 | lua_CFunction on_state_create_func; | ||
| 94 | |||
| 95 | struct s_Keepers* keepers; | ||
| 96 | |||
| 97 | // Initialized by 'init_once_LOCKED()': the deep userdata Linda object | ||
| 98 | // used for timers (each lane will get a proxy to this) | ||
| 99 | volatile DEEP_PRELUDE* timer_deep; // = NULL | ||
| 100 | |||
| 101 | #if HAVE_LANE_TRACKING | ||
| 102 | MUTEX_T tracking_cs; | ||
| 103 | struct s_lane* volatile tracking_first; // will change to TRACKING_END if we want to activate tracking | ||
| 104 | #endif // HAVE_LANE_TRACKING | ||
| 105 | |||
| 106 | MUTEX_T selfdestruct_cs; | ||
| 107 | |||
| 108 | // require() serialization | ||
| 109 | MUTEX_T require_cs; | ||
| 110 | |||
| 111 | // Lock for reference counter inc/dec locks (to be initialized by outside code) TODO: get rid of this and use atomics instead! | ||
| 112 | MUTEX_T deep_lock; | ||
| 113 | MUTEX_T mtid_lock; | ||
| 114 | |||
| 115 | int last_mt_id; | ||
| 116 | |||
| 117 | #if USE_DEBUG_SPEW | ||
| 118 | int debugspew_indent_depth; | ||
| 119 | #endif // USE_DEBUG_SPEW | ||
| 120 | |||
| 121 | struct s_lane* volatile selfdestruct_first; | ||
| 122 | // After a lane has removed itself from the chain, it still performs some processing. | ||
| 123 | // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads | ||
| 124 | int volatile selfdestructing_count; | ||
| 125 | }; | ||
| 126 | |||
| 127 | struct s_Universe* get_universe( lua_State* L); | ||
| 128 | extern void* const UNIVERSE_REGKEY; | ||
| 129 | |||
| 130 | // ################################################################################################ | ||
| 65 | 131 | ||
| 66 | #ifdef NDEBUG | 132 | #ifdef NDEBUG |
| 67 | #define _ASSERT_L(lua,c) /*nothing*/ | 133 | #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* | |||
| 102 | 168 | ||
| 103 | // ################################################################################################ | 169 | // ################################################################################################ |
| 104 | 170 | ||
| 105 | // this is pointed to by full userdata proxies, and allocated with malloc() to survive any lua_State lifetime | ||
| 106 | typedef struct | ||
| 107 | { | ||
| 108 | volatile int refcount; | ||
| 109 | void* deep; | ||
| 110 | // when stored in a keeper state, the full userdata doesn't have a metatable, so we need direct access to the idfunc | ||
| 111 | luaG_IdFunction idfunc; | ||
| 112 | } DEEP_PRELUDE; | ||
| 113 | |||
| 114 | enum eLookupMode | 171 | enum eLookupMode |
| 115 | { | 172 | { |
| 116 | eLM_LaneBody, // send the lane body directly from the source to the destination lane | 173 | 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_, | |||
| 136 | 193 | ||
| 137 | // ################################################################################################ | 194 | // ################################################################################################ |
| 138 | 195 | ||
| 139 | /* | ||
| 140 | * Do we want to activate full lane tracking feature? (EXPERIMENTAL) | ||
| 141 | */ | ||
| 142 | #define HAVE_LANE_TRACKING 1 | ||
| 143 | |||
| 144 | // ################################################################################################ | ||
| 145 | |||
| 146 | // everything regarding the a Lanes universe is stored in that global structure | ||
| 147 | // held as a full userdata in the master Lua state that required it for the first time | ||
| 148 | // don't forget to initialize all members in LG_configure() | ||
| 149 | struct s_Universe | ||
| 150 | { | ||
| 151 | // for verbose errors | ||
| 152 | bool_t verboseErrors; | ||
| 153 | |||
| 154 | lua_CFunction on_state_create_func; | ||
| 155 | |||
| 156 | struct s_Keepers* keepers; | ||
| 157 | |||
| 158 | // Initialized by 'init_once_LOCKED()': the deep userdata Linda object | ||
| 159 | // used for timers (each lane will get a proxy to this) | ||
| 160 | volatile DEEP_PRELUDE* timer_deep; // = NULL | ||
| 161 | |||
| 162 | #if HAVE_LANE_TRACKING | ||
| 163 | MUTEX_T tracking_cs; | ||
| 164 | struct s_lane* volatile tracking_first; // will change to TRACKING_END if we want to activate tracking | ||
| 165 | #endif // HAVE_LANE_TRACKING | ||
| 166 | |||
| 167 | MUTEX_T selfdestruct_cs; | ||
| 168 | |||
| 169 | // require() serialization | ||
| 170 | MUTEX_T require_cs; | ||
| 171 | |||
| 172 | // Lock for reference counter inc/dec locks (to be initialized by outside code) TODO: get rid of this and use atomics instead! | ||
| 173 | MUTEX_T deep_lock; | ||
| 174 | MUTEX_T mtid_lock; | ||
| 175 | |||
| 176 | int last_mt_id; | ||
| 177 | |||
| 178 | #if USE_DEBUG_SPEW | ||
| 179 | int debugspew_indent_depth; | ||
| 180 | #endif // USE_DEBUG_SPEW | ||
| 181 | |||
| 182 | struct s_lane* volatile selfdestruct_first; | ||
| 183 | // After a lane has removed itself from the chain, it still performs some processing. | ||
| 184 | // The terminal desinit sequence should wait for all such processing to terminate before force-killing threads | ||
| 185 | int volatile selfdestructing_count; | ||
| 186 | }; | ||
| 187 | |||
| 188 | struct s_Universe* get_universe( lua_State* L); | ||
| 189 | extern void* const UNIVERSE_REGKEY; | ||
| 190 | |||
| 191 | // ################################################################################################ | ||
| 192 | |||
| 193 | extern char const* const CONFIG_REGKEY; | 196 | extern char const* const CONFIG_REGKEY; |
| 194 | extern char const* const LOOKUP_REGKEY; | 197 | extern char const* const LOOKUP_REGKEY; |
| 195 | 198 | ||
