Hi, should thread-shared static variable hg_progress_shutdown_flag be protected by locks?
|
hg_engine_finalize(void) |
|
{ |
|
int ret; |
|
|
|
/* tell progress thread to wrap things up */ |
|
hg_progress_shutdown_flag = 1; |
|
|
|
/* wait for it to shutdown cleanly */ |
|
ret = pthread_join(hg_progress_tid, NULL); |
|
assert(ret == 0); |
|
(void) ret; |
|
|
|
return; |
|
} |
|
static void * |
|
hg_progress_fn(void *foo) |
|
{ |
|
hg_return_t ret; |
|
unsigned int actual_count; |
|
(void) foo; |
|
|
|
while (!hg_progress_shutdown_flag) { |
|
do { |
|
ret = HG_Trigger(hg_context, 0, 1, &actual_count); |
|
} while ( |
|
(ret == HG_SUCCESS) && actual_count && !hg_progress_shutdown_flag); |
|
|
|
if (!hg_progress_shutdown_flag) |
|
HG_Progress(hg_context, 100); |
|
} |
|
|
|
return (NULL); |
|
} |
Hi, should thread-shared static variable
hg_progress_shutdown_flagbe protected by locks?mercury/Examples/src/example_rpc_engine.c
Lines 50 to 63 in ce847b7
mercury/Examples/src/example_rpc_engine.c
Lines 66 to 84 in ce847b7