Work around issue found by Coverity. Coverity complained about non-atomic use of the variable p in join_threads.  The pointer was set when the lock was held, then the lock was released and reacquired.  The pointer should then not be used again, since another thread might have done something to it in the mean time.
Work around issue found by Coverity.
Coverity complained about non-atomic use of the variable p in
join_threads.  The pointer was set when the lock was held, then the
lock was released and reacquired.  The pointer should then not be used
again, since another thread might have done something to it in the
mean time.

zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb,zyzyis/monetdb