Dynamically allocated GMutex and GCond variables
The GLib documentation says statically allocated GMutex and GCond
variables do not need initialized. This seems to imply magic on
first use. That magic could be possible, but would be inefficient.
More likely is that they meant statical globals don't need initialization
because they are zero'd, where static locals are on the stack and could
be / are uninitialized? But even that doesn't mesh with some runtime
behavior I've sometimes seen with my two statically allocated global
GMutex/GCond pairs:
+ Not running as daemon
+ Begin scanning /var/lib/corewatcher/...
GLib (gthread-posix.c): Unexpected error from C library during
'pthread_mutex_lock': Invalid argument. Aborting.
Converting them to dynamically allocated variables, with the whole slough
of new/init/clear/free calls seems to fix this as expected. Of course
the clear/free calls are never reached, since the threads only end/exit
via an (currently) unhandled signal and thus add to the list of things
about which valgrind complains at exit.
Signed-off-by: Tim Pepper <timothy.c.pepper@linux.intel.com>