Mailing List Archive


I'm currently un-leaking the mbox and clamd code.
Since I have never used pthreads in C before, can anyone here point me
to an introduction to pthreads programming which is available online?

The current problem:
If a clamd thread runs into a timeout, it is/should be cancelled by the
watcher thread using pthread_cancel(3).
It really is cancelled, but any resources allocated before (open
directories, strdup()ed pathnames, file buffers etc) are not free()d,
resulting in more or less big memleaks.
SO one can now either manage a list of resources to be free()d/close()d
and install a cleanup handler for that, or set a thread-global which is
honored in all the scanning loops to break out and clean up as usual.

All I have heard about threads (from a programmers pov) is that is
mainly equal to multiple processes, but global variables are to be
avoided. And I don't know about variable scope in threads, either :-(