watcher: Prevent race condition spawning multiple watcher threads
authorMartin Willi <martin@revosec.ch>
Wed, 11 Jun 2014 13:04:15 +0000 (15:04 +0200)
committerMartin Willi <martin@revosec.ch>
Tue, 17 Jun 2014 13:19:47 +0000 (15:19 +0200)
commitbc1139480f42859a4b26fe8518ef9dd7c2849a49
treef988a5a397831b20697587dee855eab577cb9af2
parent23750961d5b9052ddfe6d4746435e84ca0c87a10
watcher: Prevent race condition spawning multiple watcher threads

If file descriptors get added and removed in rapid succession, the active
watcher thread might not take notice of it and continues running. However, add()
spawns a watcher thread whenever a file descriptor is added to an empty set.
This could result in multiple watcher threads, which is fixed by a proper
check for running watchers.
src/libstrongswan/processing/watcher.c