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 <>
parent 4bb837e8
......@@ -42,7 +42,7 @@ int PrintCategories(FILE * fp, int myThreadId);
int myThreadId = (int)((intptr_t)p);
int myThreadId = (int)(long)p;
PrintControlVars(stdout, myThreadId);
......@@ -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);
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