Blitzthreads lets you spawn windows-driven threads(Including dynamic priority per thread) within bmax.
This version is freeware.
With this you can run functions side by side your main app.
You can run upto 2024 threads at once(Although I wouldn't suggest it...:) )
www.excess.eclipse.co.uk/dreamspace.mod.zip
It's object driven, although there are function wrappers for those used to that.
Classes are(There's no docs)
TThread.
Global functions(Contained within TThread. I.e TThread.
Create() )
Create( BlitzFunction ) Create a thread and return a TThread object.
RunAll() 'Runs all threads
PauseAll() 'Pauses all threads
StopAll() 'Stops all threads
Local functions specific to each thread instance,
Run() 'Runs the function provided when creating the thread, in another thread.
Priority( Value:Int) 'Set the threads priority, value ranges from 1 to 7. (default = 3, pre-set)
Pause() 'Pause the thread
Resume() 'Resume the thread,
-
Global functions within TThread to allow async data access,
All return a TResource object/integer handle.
ProtectInt( x variable )
ProtectFloat( x variable )
ProtectBank( Bank:TBank )
ProtectStream( Stream:TStream )
-
With the tResource object returned, you can lock access rights to it within your thread,
Wrapper functions are,
ThreadHandle =CreateThread( Function )
PauseThread( ThreadHandle )
ThreadPriority( ThreadHandle,Priority )
PauseThread(Threadhandle)
ResumeThread(ThreadHandle)
StopThread(ThreadHandle)
RunThread(ThreadHandle)
There's also a manual locking system, in addition to protected storage.
Lock = CreateLock()
RequestLock(Lock)
ReleaseLock(lock)
which allows you to restrict threads of the same locking patterns to one run at a time.(Prevent deadlocks..if you're lucky :) )
TestApp
Simple mode
Advanced Mode
To install, copy dreamspace.mod folder into your bmax mod folder(Windows only atm) and you're done.
This version is freeware.
With this you can run functions side by side your main app.
You can run upto 2024 threads at once(Although I wouldn't suggest it...:) )
www.excess.eclipse.co.uk/dreamspace.mod.zip
It's object driven, although there are function wrappers for those used to that.
Classes are(There's no docs)
TThread.
Global functions(Contained within TThread. I.e TThread.
Create() )
Create( BlitzFunction ) Create a thread and return a TThread object.
RunAll() 'Runs all threads
PauseAll() 'Pauses all threads
StopAll() 'Stops all threads
Local functions specific to each thread instance,
Run() 'Runs the function provided when creating the thread, in another thread.
Priority( Value:Int) 'Set the threads priority, value ranges from 1 to 7. (default = 3, pre-set)
Pause() 'Pause the thread
Resume() 'Resume the thread,
-
Global functions within TThread to allow async data access,
All return a TResource object/integer handle.
ProtectInt( x variable )
ProtectFloat( x variable )
ProtectBank( Bank:TBank )
ProtectStream( Stream:TStream )
-
With the tResource object returned, you can lock access rights to it within your thread,
Wrapper functions are,
ThreadHandle =CreateThread( Function )
PauseThread( ThreadHandle )
ThreadPriority( ThreadHandle,Priority )
PauseThread(Threadhandle)
ResumeThread(ThreadHandle)
StopThread(ThreadHandle)
RunThread(ThreadHandle)
There's also a manual locking system, in addition to protected storage.
Lock = CreateLock()
RequestLock(Lock)
ReleaseLock(lock)
which allows you to restrict threads of the same locking patterns to one run at a time.(Prevent deadlocks..if you're lucky :) )
TestApp
Simple mode
Update = CreateThread( UpdateVal ) NetWork = CreateThread( PrintVal ) RunThread(Update) RunThread(NetWork) Global ourVal Function updateVal:Int(bb_func:Byte Ptr) repeat ourVal:+1 forever End function Function printVal:Int (bb_func:Byte Ptr) repeat Print "Val:"+OurVal Delay 1000 forever End Function Print "Thread Handle>"+Res repeat Delay 5000 Print "Master thread!" Forever
Advanced Mode
Update:TThread = TThread.Create( UpdateVal ) NetWork:TThread = TThread.Create( PrintVal ) Update.Run() Network.Run() Global ourVal Function updateVal:Int(bb_func:Byte Ptr) repeat ourVal:+1 forever End function Function printVal:Int (bb_func:Byte Ptr) repeat Print "Val:"+OurVal Delay 1000 forever End Function Print "Thread Handle>"+Res repeat Delay 5000 Print "Master thread!" Forever
To install, copy dreamspace.mod folder into your bmax mod folder(Windows only atm) and you're done.