Hey, so I'm doing a project for one of my classes that requires part of it to be multi-threaded.
Unfortunately, I am working on a Solaris box (as that's what it will be tested on) with a SPARC based processor. Also, unfortunately, I am using "CC" (I believe version 5.9) - not "g++" or anything.
Anywho, I'm trying to spawn a new thread using thr_create() - and I keep getting this warning - and I can't make it go away!!
I'm calling it like this:
I'm getting this warning message:Code:thr_create(NULL, 0, ThreadTaskLoop, NULL, THR_DETACHED, NULL);
I CAN'T MAKE IT GO AWAY!!! - I've been at it for like an hour...Code:"tcp-project2.C", line 146: Warning (Anachronism): Formal argument 3 of type extern "C" void*(*)(void*) in call to thr_create(void*, unsigned, extern "C" void*(*)(void*), void*, long, unsigned*) is being passed void*(*)(void*). 1 Warning(s) detected.
Initially I wanted to pass it a pointer to a struct, but I gave up on that (asking way too much of CC, apparently) - I just want it to stop warning.
Initially I had:
Where "args" is a struct.Code:thr_create(NULL, 0, ThreadTaskLoop, (void*)&args, THR_DETACHED, NULL);
The prototype for the function, even though I only want to pass it a struct pointer, and have no return, is this:
I realize that since the thr_create prototype expects a function pointer with a void* parameter and void* return I can't do anything about that, but OMG, I just want the stupid thing to compile without this warning.Code:void* ThreadTaskLoop(void*);
I am completely OK not passing it jack ........ at the moment.
I also tried doing this:
Understanding the possibility that the NULL macro may not be defined as:Code:thr_create(NULL, 0, ThreadTaskLoop, (void*)0, THR_DETACHED, NULL);
Same thing.Code:#define NULL (void*)0
Pleeeeeease make it go away!!!
I tried like 100 other things, too, just listed the things I expected to work here. Please don't tell me to search - I've searched, and searched, and searched, and searched.
I do see a lot of people (ie. Oracle official documentation) passing it an integer cast to a void*. Unfortunately I don't need to give my function an integer, and even if I did - I tried - I get the same warning message upon compilation.