FreeMat

- Main Page
- Related Pages

THREADFREE Free thread resources

Section: FreeMat Threads

# Usage

The `threadfree` is a function to free the resources claimed by a thread that has finished. The syntax for its use is

       threadfree(handle)

where `handle` is the handle returned by the call to `threadnew`. The `threadfree` function requires that the thread be completed. Otherwise it will wait for the thread to complete, potentially for an arbitrarily long period of time. To fix this, you can either call `threadfree` only on threads that are known to have completed, or you can call it using the syntax

       threadfree(handle,timeout)

where `timeout` is a time to wait in milliseconds. If the thread fails to complete before the timeout expires, an error occurs.