Fix race by using atomic operation, with this change, both libpthread and libthr now can run profiling on SMP.
Fix race by using atomic operation, with this change, both libpthread
and libthr now can run profiling on SMP.

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