Skip to content

Commit d849d3f

Browse files
committed
src: make main_thread_id_ atomic
The value access needs to be thread safe. PR-URL: #24 Reviewed-by: Santiago Gimeno <[email protected]>
1 parent ffb241f commit d849d3f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/nsolid/nsolid_api.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ class EnvList {
614614
nsuv::ns_mutex map_lock_;
615615
// A map of all Environments in the process.
616616
std::map<uint64_t, SharedEnvInst> env_map_;
617-
uint64_t main_thread_id_ = 0xFFFFFFFFFFFFFFFF;
617+
std::atomic<uint64_t> main_thread_id_ = {0xFFFFFFFFFFFFFFFF};
618618
// Lock EnvList while all command queues are being processed. This is to
619619
// prevent ~EnvList from running while processing all commands.
620620
nsuv::ns_mutex command_lock_;

0 commit comments

Comments
 (0)