Threaddetach
Releases a thread handle without waiting for the thread to finish
#include "fbthread.bi"
ThreadDetach( id )
ThreadDetach releases resources associated with a thread handle returned by ThreadCreate or Threadcall. The thread handle will be destroyed by ThreadDetach and cannot be used anymore.
Unlike ThreadWait, ThreadDetach does not wait for the thread to finish and thread execution continues independently. Any allocated resources will be freed once the thread exits.
Syntax
Usage
#include "fbthread.bi"
ThreadDetach( id )
Parameters
Description
ThreadDetach releases resources associated with a thread handle returned by ThreadCreate or Threadcall. The thread handle will be destroyed by ThreadDetach and cannot be used anymore.
Unlike ThreadWait, ThreadDetach does not wait for the thread to finish and thread execution continues independently. Any allocated resources will be freed once the thread exits.
Example
#include "fbthread.bi"
Sub mythread( ByVal param As Any Ptr )
Print "hi!"
End Sub
Var thread = ThreadCreate( @mythread )
threaddetach( thread )
threaddetach( ThreadCreate( @mythread ) )
Sleep
Sub mythread( ByVal param As Any Ptr )
Print "hi!"
End Sub
Var thread = ThreadCreate( @mythread )
threaddetach( thread )
threaddetach( ThreadCreate( @mythread ) )
Sleep
Dialect Differences
- Threading is not allowed in the -lang qb dialect.
Platform Differences
- ThreadDetach is not available with the DOS version of FreeBASIC, because multithreading is not supported by DOS kernel nor the used extender.
Differences from QB
- New to FreeBASIC
See also