-=MikeP=- wrote:
Hello Trog,
Wednesday, April 6, 2005, 1:38:29 PM, you wrote:
T> On Wed, 2005-04-06 at 12:57 +0400, -=MikeP=- wrote:
while all the scanning threads currently running use
pthread_rwlock_rdlock( &cl_root_rwlock ) ... pthread_rwlock_unlock(...)
clause to access root node.
So multiple scanner threads are allowed to access the tree
simultaneously while they all be prevented from accessing root node
for a short period of time while the pointers are switched.
T> Thats essentially what the old implementation did, but without using
T> rwlocks (using mutexes). The implementation in CVS is essentially lock
T> free, and no waiting is needed.
T> -trog
Well, mutexes and rwlocks are different things and I haven't seen the
way it was done earlier. But the following:
AFAIR the thread manager (main thread) wait for all workers to finish
(and suspends worker creation) on reload event, going back to normal
operation after the reload has finished.
Makes me think that current handling of database reloading, though
avoids locking, makes a break in scanning process while old threads
are still running and new threads are not created until database
refresh.
The more worker threads are currently running, the longer will be this
period when new requests would be suspended.
That's why trog changed the code to use refcounts.
Thomas
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html