Date: 02-16-2022
Return to Index
created by gbSnippets
'The PowerBASIC thread statements are presented in terms of
'when they may be used in the life cycle of a thread.
'Create a thread (starts with named function)
Thread Create FuncName (param) [StackSize,] [Suspend] TO hThread
[Thread] Function ThreadFuncName (ByVal param AS {Long | Dword}) AS {Long | Dword}
'Variables
Dim var[(subscripts)] [AS Threaded] [PTR | POINTER] [AT address] 'array
Dim var AS [Threaded] [PTR|POINTER] 'scalar
Threaded variable[()] [AS Type] [, variable[()]]
Threaded variable[()] [, variable[()]] [, ...] AS Type
'Monitor activity
lCount& = ThreadCount 'returns # of PowerBASIC threads
thrdID& = ThreadID 'get thread ID number
'Get/Set Priority
Thread Get PRIORITY hThread TO lResult&
Thread Set PRIORITY hThread, Priority&
'Suspension
Thread Suspend hThread TO lResult& 'Suspend execution of a Thread
Thread Resume hThread TO lResult& 'Decrease suspend count of a thread
'End of life (thread ends naturally)
Thread Close hThread TO lResult& 'Releases handle of a thread
Thread Status hThread TO lResult& 'Get Thread Return value
'gbs_00341
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm