aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/LuaSL/LuaSL_main.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-05-13 13:15:42 +1000
committerDavid Walter Seikel2014-05-13 13:15:42 +1000
commitafd126e1d207c8fe7933562227f16684b00bfc7c (patch)
tree0f34168d20e485738fcfd1b5d67cf5e0d1bb8113 /src/LuaSL/LuaSL_main.c
parentDedicating my lifes work to my girl Boots. (diff)
downloadSledjHamr-afd126e1d207c8fe7933562227f16684b00bfc7c.zip
SledjHamr-afd126e1d207c8fe7933562227f16684b00bfc7c.tar.gz
SledjHamr-afd126e1d207c8fe7933562227f16684b00bfc7c.tar.bz2
SledjHamr-afd126e1d207c8fe7933562227f16684b00bfc7c.tar.xz
Finish separating out love.
Diffstat (limited to 'src/LuaSL/LuaSL_main.c')
-rw-r--r--src/LuaSL/LuaSL_main.c37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c
index f4c94ac..0d8a6db 100644
--- a/src/LuaSL/LuaSL_main.c
+++ b/src/LuaSL/LuaSL_main.c
@@ -1,5 +1,6 @@
1 1
2#include "LuaSL.h" 2#include "LuaSL.h"
3#include "Runnr.h"
3 4
4 5
5int logDom; // Our logging domain. 6int logDom; // Our logging domain.
@@ -110,7 +111,7 @@ void scriptSendBack(void * data)
110 else if (0 == strncmp(message->message, "llResetScript(", 14)) 111 else if (0 == strncmp(message->message, "llResetScript(", 14))
111 resetScript(message->script); 112 resetScript(message->script);
112 else 113 else
113 sendBack(ourGlobals, message->script->client, message->script->SID, message->message); 114 sendBack(message->script->client, message->script->SID, message->message);
114 free(message); 115 free(message);
115} 116}
116 117
@@ -166,10 +167,10 @@ static Eina_Bool _data(void *data, int type __UNUSED__, Ecore_Con_Event_Client_D
166 me->client = ev->client; 167 me->client = ev->client;
167 eina_hash_add(ourGlobals->scripts, me->SID, me); 168 eina_hash_add(ourGlobals->scripts, me->SID, me);
168 eina_hash_add(ourGlobals->names, me->fileName, me); 169 eina_hash_add(ourGlobals->names, me->fileName, me);
169 sendBack(ourGlobals, ev->client, SID, "compiled(true)"); 170 sendBack(ev->client, SID, "compiled(true)");
170 } 171 }
171 else 172 else
172 sendBack(ourGlobals, ev->client, SID, "compiled(false)"); 173 sendBack(ev->client, SID, "compiled(false)");
173 } 174 }
174 else if (0 == strcmp(command, "run()")) 175 else if (0 == strcmp(command, "run()"))
175 { 176 {
@@ -238,6 +239,8 @@ int main(int argc, char **argv)
238 { 239 {
239 if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals))) 240 if ((ourGlobals.server = ecore_con_server_add(ECORE_CON_REMOTE_TCP, ourGlobals.address, ourGlobals.port, &ourGlobals)))
240 { 241 {
242 int i;
243
241 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &ourGlobals); 244 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_ADD, (Ecore_Event_Handler_Cb) _add, &ourGlobals);
242 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &ourGlobals); 245 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DATA, (Ecore_Event_Handler_Cb) _data, &ourGlobals);
243 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &ourGlobals); 246 ecore_event_handler_add(ECORE_CON_EVENT_CLIENT_DEL, (Ecore_Event_Handler_Cb) _del, &ourGlobals);
@@ -247,26 +250,18 @@ int main(int argc, char **argv)
247 ecore_con_server_client_limit_set(ourGlobals.server, 3, 0); 250 ecore_con_server_client_limit_set(ourGlobals.server, 3, 0);
248 clientStream = eina_strbuf_new(); 251 clientStream = eina_strbuf_new();
249 252
250 if (edje_init()) 253 result = 0;
254 compilerSetup(&ourGlobals);
255 luaprocInit();
256 for (i = 0; i < CPUs; i++)
251 { 257 {
252 int i; 258 if ( sched_create_worker( ) != LUAPROC_SCHED_OK )
253 259 PE("Error creating luaproc worker thread.");
254 result = 0;
255 compilerSetup(&ourGlobals);
256 luaprocInit();
257 for (i = 0; i < CPUs; i++)
258 {
259 if ( sched_create_worker( ) != LUAPROC_SCHED_OK )
260 PE("Error creating luaproc worker thread.");
261 }
262 ecore_main_loop_begin();
263
264 // TODO - this is what hangs the system, should change from raw pthreads to ecore threads.
265 sched_join_workerthreads();
266 edje_shutdown();
267 } 260 }
268 else 261 ecore_main_loop_begin();
269 PC("Failed to init edje!"); 262
263 // TODO - this is what hangs the system, should change from raw pthreads to ecore threads.
264 sched_join_workerthreads();
270 } 265 }
271 else 266 else
272 PC("Failed to add server!"); 267 PC("Failed to add server!");