\section{THREADFREE Free thread resources}

\subsection{Usage}

The \verb|threadfree| is a function to free the resources claimed
by a thread that has finished.  The syntax for its use is
\begin{verbatim}
   threadfree(handle)
\end{verbatim}
where \verb|handle| is the handle returned by the call to \verb|threadnew|.
The \verb|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 \verb|threadfree| only on threads that are known to have
completed, or you can call it using the syntax
\begin{verbatim}
   threadfree(handle,timeout)
\end{verbatim}
where \verb|timeout| is a time to wait in milliseconds.  If the thread
fails to complete before the timeout expires, an error occurs.

