Split transaction.[ch] (Redmine #2072)

transaction.c contained four separate pieces of code:
 - CFEngine language-level promise locks (split to locks.h)
 - Wrappers for pthread mutexes (split to mutex.h)
 - Logging utility function (moved to logging.c)
 - Utility function for cf-execd (moved to cf-execd-runner.c)
Document side-effects of functions in matching.c