Merge pull request #4 from adaptivecomputing/4.2.0

Merge pull request #30 from actorquedeveloper/master
Merge from trunk Fix for TRQ-1447: Desadlock in server under load.
Fix a deadlock introduced by the mutex managing code in job_route()
Fix a crash in get_jobs_array(), if the job has disappeared, then we need to make sure we have a valid array before attempting to unlock it.
Forward-port debug support for community spec file to 4.2 branch.
Forward-port bug60 fix to 4.2 branch.
Find queue *inside* the loop in case the queue has been deleted by the
user at runtime.  Also add logging for conditions which would
terminate the thread.
Disable monitoring of routing retry thread since it's now done with
multiple threads (one per routing queue).  We need to add monitoring
for each thread as well as a mechanism to start routing threads for
dynamically-created queues.  TODO++  :-)
Fix deadlock in find_queuebyname().  Locking allques_mutex is required
for the hash table lookup, not the locking of the specific queue.  If
queue Q is locked by thread B and allques_mutex by thread A in
find_queuebyname(), when thread A attempts to lock queue Q, it will
block waiting for thread B's lock.  If thread B then tries to lock
allques_mutex, the two deadlock.

Unlock allques_mutex first, then lock the queue, to prevent this
situation.
Since find_queuebyname() is now at the start of the loop, and it
handles locking the queue for us, remove the mutex_mgr object.
Log routing of jobs.  Watching for memory corruption of queue pointers.
This causes abort() to be called when head is an empty list.  Remove.
Just use straight %p.
Remove an unnecessary mutex manager.
Wrap a log_event in {} as was intended originally but not done correctly.
changed mutex locking function calls to use LOGLEVEL and not 0
Merge branch '4.2.0' of https://github.com/actorquedeveloper/torque into 4.2.0
Various build/distcheck fixes.
TRQ-1602. Modified pam_pbssimpleauth.c to remove compile time
error when using --with-pam
Fix a g++ error with --enable-shell-use-argv