-
-
Couldn't load subscription status.
- Fork 496
Multithreading #1964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multithreading #1964
Conversation
|
This is cool. |
|
OOP support pls |
|
Is it possible to change |
yes |
|
Is it available on serverside or clientside? |
|
Both, refer to the code |
|
This draft pull request is stale because it has been open for at least 90 days with no activity. Please continue on your draft pull request or it will be closed in 30 days automatically. |
|
This draft pull request was closed because it has been marked stale for 30 days with no activity. |
Option to execute custom time consuming tasks without blocking main thread.
current functions list, its syntax and purpose:
createThread(string code)-- Creates a new thread and start executing code which in that threadgetThreadState(thread)-- Return current state of threadthreadCall(thread, functionName, table of arguments)-- calling function inside thread.killThread(thread, terminate)-- sends signal to kill thread, wait 1 second ( if second parametr is false ) and then terminates a thread forcefully, ending its execution.getThreadFailureReason(thread)-- In case of error thrown insidethreadGetResult(thread)-- Returns value thread returned at the end ( if something have been returned and code reached end )getThreads()-- return all threadssetThreadShutdownHandler(thread, callback)-- when "exit" get called inside threadFunction availiable only in thread:
sleep(ms)--exit(...)-- stopping thread, send data to shutdown handlersendMessage(...)-- sends message that you can catch usingsetThreadCustomHandlerin main threadMaybe:
bool isMainThread()-- return true if called in main thread, otherwise false.setThreadOutputHandler(thread, callback)-- to set where are outputs from print, outputChatBox ect. will redirected,setThreadErrorHandler(thread, callback)-- to set where to output errorssetThreadCustomHandler(thread, callback)-- used for communication from thread, to main thread ( i don't have idea how to name it )threadLoadstring(thread, code)-- to load extra code into thread ( if while creating you explicit allow it in options )getThreadsLimits()-- Clientside, returns information about user settings, how many threads can be created ect.getThreadtimings(thread)-- https://docs.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-getthreadtimesstartThread(thread)-- Starts the thread.pauseThread(thread)-- Pause the thread. -just calling "sleep" function all time until "start" get calledMaybe in future, option to create thread-safe variable, name based on std::atomic
atomic createAtomic( ... )values getAtomicValue( atomic )bool setAtomicValue( ... )Other:
Current example: