SRL Archive - FAQ

Multi-Threading


nen

2011-12-24 15:54:13

Are we able to use multi threading in our scripts? I''m trying to convert myself from Java here….

YoHoJo

2011-12-24 16:01:10

There was talk about it before try searching for it.
From what I remember I don't think we do it, or gotta do it some ghetto way.

Kyle Undefined

2011-12-24 16:09:09

Nope, AFAIK you can't. However I haven't seen the ghetto rig.

Brandon

2011-12-24 16:36:08

Ummm Can you not create a plugin that takes a function as it's parameter and suspend it in a thread??

Like create a plugin with the thread class.. Example:


#include <windows.h>
#include <stdio.h>

static DWORD WINAPI ThreadProc(void* Function)
{
while(true)
{
Function;
Sleep(1000);
}
return 0;
}

__declspec( dllexport ) int WINAPI CreateThread()
{
CreateThread(0, 0, ThreadProc, 0, 0, 0);
return 0;
}

Convert that to pascal.. it should work.. It creates a thread that takes a function (simba function) and that function runs in the thread while simba does other shit since this would be a plugin..

Nava2

2011-12-24 22:43:11

The only catch is that you have no way to communicate with variables.

Flight

2011-12-25 01:33:33

Haven't we been down this road already?

Main

2011-12-25 01:37:10

Unfortunately no:( But you can always do pesudo, and tbh, pesudo is good enough around here for most cases:P