aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL/LuaSL_threads.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/LuaSL/LuaSL_threads.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/LuaSL/LuaSL_threads.c b/src/LuaSL/LuaSL_threads.c
index e326e14..4746808 100644
--- a/src/LuaSL/LuaSL_threads.c
+++ b/src/LuaSL/LuaSL_threads.c
@@ -186,20 +186,24 @@ static void *workermain( void *args ) {
186 /* check if process finished its whole execution, then recycle it */ 186 /* check if process finished its whole execution, then recycle it */
187 if (procstat == 0) 187 if (procstat == 0)
188 { 188 {
189 recycled *trash = malloc(sizeof(recycled)); 189// recycled *trash = malloc(sizeof(recycled));
190 190
191 // TODO - Trash stuff trashes memory, fix it.
192 // Later, it's an optimization we don't need right now.
193/*
191 if (trash) 194 if (trash)
192 { 195 {
193 trash->L = lp->L; 196 trash->L = lp->L;
194 pthread_mutex_lock(&mutex_recycle_list); 197 pthread_mutex_lock(&mutex_recycle_list);
195 eina_clist_add_tail(&recyclelp, &(trash->node)); 198 eina_clist_add_tail(&recyclelp, &(trash->node));
196 pthread_mutex_unlock(&mutex_recycle_list); 199 pthread_mutex_unlock(&mutex_recycle_list);
197 sched_lpcount_dec();
198 } 200 }
201*/
202 sched_lpcount_dec();
199 lua_close(lp->L); 203 lua_close(lp->L);
200 if (lp->timer) 204 if (lp->timer)
201 ecore_timer_del(lp->timer); 205 ecore_timer_del(lp->timer);
202 free(lp); 206// free(lp);
203 } 207 }
204 208
205 /* check if process yielded */ 209 /* check if process yielded */
@@ -295,7 +299,7 @@ int sched_create_worker(void)
295void newProc(const char *code, int file, script *lp) 299void newProc(const char *code, int file, script *lp)
296{ 300{
297 int ret; 301 int ret;
298 recycled *trash; 302// recycled *trash;
299 303
300 // Try to recycle a Lua state, otherwise create one from scratch. 304 // Try to recycle a Lua state, otherwise create one from scratch.
301#if 0 // TODO - something about this causes a crash. 305#if 0 // TODO - something about this causes a crash.
@@ -401,6 +405,13 @@ const char *sendToChannel(gameGlobals *ourGlobals, const char *SID, const char *
401 const char *result = NULL; 405 const char *result = NULL;
402 script *dstlp; 406 script *dstlp;
403 407
408 if (!message)
409 {
410 PE("sendToChannel NULL message to %s", SID);
411 return NULL;
412 }
413// PD("sendToChannel message to %s -> %s", SID, message);
414
404 /* get exclusive access to operate on channels */ 415 /* get exclusive access to operate on channels */
405 pthread_mutex_lock(&mutex_channel); 416 pthread_mutex_lock(&mutex_channel);
406 417