Commit 7288ffe0 authored by Junchao Zhang's avatar Junchao Zhang Committed by Kenneth Raffenetti
Browse files

Fix a problem in passing thread id to a function



The old code used (void*)(intptr_t)i to pass the thread id i.
However intptr_t is C99, so I changed it to (void*)(long)i.

Direct usage of (void*)i will issue a compilation warning
saying it is dangerous to convert integer to pointer.

Fixes #1956
Signed-off-by: Kenneth Raffenetti's avatarKen Raffenetti <raffenet@mcs.anl.gov>
parent 4bb837e8
......@@ -42,7 +42,7 @@ int PrintCategories(FILE * fp, int myThreadId);
MTEST_THREAD_RETURN_TYPE RunTest(void *p)
{
int myThreadId = (int)((intptr_t)p);
int myThreadId = (int)(long)p;
PrintControlVars(stdout, myThreadId);
if (DOPRINT)
......@@ -79,8 +79,7 @@ int main(int argc, char *argv[])
/* Spawn threads */
for (i = 0; i < NTHREADS; i++) {
intptr_t tid = (intptr_t)i;
MTest_Start_thread(RunTest, (void *)tid);
MTest_Start_thread(RunTest, (void *)(long)i);
}
MTest_Join_threads();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment