mercury-hpc / mercury

Mercury is a C library for implementing RPC, optimized for HPC.
http://www.mcs.anl.gov/projects/mercury/
BSD 3-Clause "New" or "Revised" License
170 stars 62 forks source link

HG examples: Possible data races #563

Open ryancaicse opened 2 years ago

ryancaicse commented 2 years ago

Hi, should thread-shared static variable hg_progress_shutdown_flag be protected by locks?

https://github.com/mercury-hpc/mercury/blob/ce847b771def57e9d63f33313ed81149b366648b/Examples/src/example_rpc_engine.c#L50-L63

https://github.com/mercury-hpc/mercury/blob/ce847b771def57e9d63f33313ed81149b366648b/Examples/src/example_rpc_engine.c#L66-L84

soumagne commented 2 years ago

Yes you're right sorry, that's been low-priority for me on my list but that should be fixed to either use an atomic variable or use a lock.