Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: ClamAV: devel

pthreads

 

 

ClamAV devel RSS feed   Index | Next | Previous | View Threaded


Thomas.Lamy at in-online

Sep 6, 2003, 9:10 AM

Post #1 of 1 (412 views)
Permalink
pthreads

Hi,

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 :-(


Thomas

ClamAV devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.