Fix a race in regard of p_numthreads.
Fix a race in regard of p_numthreads.

Submitted by:	Giovanni Trematerra
		<giovanni dot trematerra at gmail dot com>

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase