aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--lib/LSL.lua2
-rw-r--r--src/LuaSL/LuaSL_main.c7
-rw-r--r--src/LuaSL/LuaSL_threads.c19
3 files changed, 24 insertions, 4 deletions
diff --git a/lib/LSL.lua b/lib/LSL.lua
index 65aef77..695c05d 100644
--- a/lib/LSL.lua
+++ b/lib/LSL.lua
@@ -802,9 +802,11 @@ function waitAndProcess(returnWanted)
802 elseif result1 then 802 elseif result1 then
803 -- Check if we are waiting for a return, and got it. 803 -- Check if we are waiting for a return, and got it.
804 if returnWanted and string.match(message, "^return ") then 804 if returnWanted and string.match(message, "^return ") then
805-- print("RETURNING " .. result1)
805 return result1 806 return result1
806 end 807 end
807 -- Otherwise, just run it and keep looping. 808 -- Otherwise, just run it and keep looping.
809-- print("RUNNING " .. result1)
808 status, errorMsg = luaproc.send(sid, result1) 810 status, errorMsg = luaproc.send(sid, result1)
809 if not status then 811 if not status then
810 msg("Error sending results from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg) 812 msg("Error sending results from " .. Type .. ": " .. message .. " ERROR MESSAGE: " .. errorMsg)
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index cb2726e..017c742 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -51,6 +51,7 @@ static void resetScript(script *victim)
51 51
52 PD("RESETTING %s", victim->name); 52 PD("RESETTING %s", victim->name);
53 sendToChannel(ourGlobals, victim->SID, "quit()"); 53 sendToChannel(ourGlobals, victim->SID, "quit()");
54
54 eina_hash_del(ourGlobals->scripts, victim->SID, NULL); 55 eina_hash_del(ourGlobals->scripts, victim->SID, NULL);
55 eina_hash_del(ourGlobals->names, victim->fileName, NULL); 56 eina_hash_del(ourGlobals->names, victim->fileName, NULL);
56 57
@@ -73,6 +74,12 @@ void scriptSendBack(void * data)
73 scriptMessage *message = data; 74 scriptMessage *message = data;
74 gameGlobals *ourGlobals = message->script->game; 75 gameGlobals *ourGlobals = message->script->game;
75 76
77 if (!message->script)
78 {
79 PE("scriptSendBack script is NULL");
80 return;
81 }
82
76 if (0 == strncmp(message->message, "llSleep(", 8)) 83 if (0 == strncmp(message->message, "llSleep(", 8))
77 ecore_timer_add(atof(&(message->message)[8]), _sleep_timer_cb, message->script); 84 ecore_timer_add(atof(&(message->message)[8]), _sleep_timer_cb, message->script);
78 else if (0 == strncmp(message->message, "llSetTimerEvent(", 16)) 85 else if (0 == strncmp(message->message, "llSetTimerEvent(", 16))
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