Fix HAVE_NOT_GCC_BUG_56273 test

HAVE_NOT_GCC_BUG_56273 always failed because the program
would not link.  Add a main and replace `bar()` with a
standard library function call so the test program can link
if it can compile.
Kill dead code
Write thread mutex abstraction

Mutex and associated functions provide never-failing
lock/unlock operations and the lack of a static initializer
(a la PTHREAD_MUTEX_INITIALIZER, known to cause bugs in some
cases).