|
|
hi,
"Melody" <nomail@nomail> wrote:
> "Melody" <nomail@nomail> wrote:
> > libpthreadGC2.a pthreadGC2.dll
> >
> > #include <pthread.h>
> > #include <unistd.h>
>
> C:\mirc614\irc\timer.h|32|warning: control reaches end of non-void function
> [-Wreturn-type]
>
> whats the fix for that warning? for this "non-void function"
> ??? compiler wont allow returning anything ??
>
> void * twait(int secs)
> {
> /// do something here
> }
>
> newthread launcher from a dll - follow up.
>
> int timer1(HWND mWnd, int secs, void * func)
> {
> pthread_t thread; int err;
> err = pthread_create(&thread, NULL, func, (void *)secs);
> if (err) return 1;
> return 0;
> }
>
> timer1(mWnd,0,twait);
> working now,
> but is 4th parameter done the right way? what about &secs ??
am fairly sure that should be 'void twait(int);', and I'd keep "do something
here" to just setting some (global) flag.
<https://www.gnu.org/software/libc/manual/html_node/Basic-Signal-Handling.html>
(specific to that library but the same principles apply)
and re 4th argument, you're converting the number of seconds to a pointer
(value), did you mean 'pthread_create(&thread, NULL, func, &secs)'? no need
(usually) to explicitly cast to '(void *)'.
regards, jr.
Post a reply to this message
|
|