A Scripting Language for Web, Linux and Windows

A Scripting Language for Web, Linux and Windows

Thread functions

The following thread functions are supported.

Function/Arguments Return Description
thread_create (string function, [mixed arg1...]) handle Create a new thread which will be run on function. Optional function arguments can be set. On success the new thread handle is returned, otherwise null is returned. Note! To start the thread you have to call thread_start().
thread_start (handle thread) bool Start the thread which was created with thread_create(). On success true is returned.
thread_join (handle thread, number milliseconds=0) bool Join the thread a specific time in milliseconds. If milliseconds=0 the thread is joined infinite until it was finished. If the thread was finished then true is returned.
thread_wait (handle thread, number milliseconds=0) bool thread_wait() must be called within the thread function and waits for a thread_signal(). If milliseconds=0 the thread waits infinite time. If thread_signal() was received true is returned.
thread_signal (handle thread) bool Send the waiting thread a signal to weak up from thread_wait() function. On success true is returned.
thread_kill (handle thread) bool Kill a active thread immediately. On succes true is returned.
thread_close (handle thread) bool Close the thread handle. If thread is still active it will be killed before. On success true is returned.
thread_is_active (handle thread) bool Return true if the thread is active (running).
thread_set_finish (handle thread) bool Tell the thread that it should finish. thread_set_finish() will set only a flag to be checked with thead_is_finish(). If thread is waiting you have to weak up the thread with thread_signal(). On success true is returned.
thread_is_finish (handle thread) bool Return true if the thread should finish.
thread_suspend (handle thread) bool Suspend the thread. On success true is returned.
thread_resume (handle thread) bool Resume the thread. On success true is returned.
thread_sync_enter (handle thread) bool Enter a thread synchronized program part. All instructions between thread_sync_enter() and thread_sync_leave() are exclusive executed and not involved by any other thread which will wait until thread_sync_leave() was called. On success true is returned.
thread_sync_leave (handle thread) bool Leave a thread synchronized program part. On success true is returned.
sleep (number milliseconds) true Sleep some milliseconds.

back to Home

V1 Version 0.95 - Documentation generated Sun, 02 Dec 2018 16:29