Writing to killed needs to be protected by the mutex, there is also a
possibility of losing the sent signal unless we do it while the mutex
is acquired (a signal is not a semaphore).
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
There is absolutely no need to lock and unlock the mutex on every
iteration, especially given that one cannot observe this behavior (as
there is nothing at all that guarantees that something can aquire the
lock inbetween those two calls).
There is also no need to check if we are killed twice, once is
sufficient
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
There is no need to use reinterpret_cast when the destination or
source type is pointer-to-void, static_cast is more accurate (and
safer).
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>