Thread: Re: Unixware Patch (Was: Re: Beta2 Tag'd and Bundled ...)
--On Wednesday, September 03, 2003 17:09:49 -0400 Bruce Momjian <pgman@candle.pha.pa.us> wrote: > Larry Rosenman wrote: >> >> >> --On Wednesday, September 03, 2003 16:51:51 -0400 Bruce Momjian >> <pgman@candle.pha.pa.us> wrote: >> >> > Larry Rosenman wrote: >> >> > From UnixWare: >> >> >> >> $ cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl >> >> UX:acomp: WARNING: "test_thread.c", line 60: argument #3 incompatible >> >> with prototype: pthread_create() >> >> UX:acomp: WARNING: "test_thread.c", line 61: argument #3 incompatible >> >> with prototype: pthread_create() >> >> $ ./test_thread >> >> Your functions are all thread-safe >> >> $ >> > >> > Well, that's great news, and so clear too! >> > >> > I am curious about the compiler warnings. >> > >> > What does your OS want for the 3rd argument of pthread_create()? I >> > thought a void pointer would be OK for everyone: >> > >> > pthread_create(&thread1, NULL, (void *) func_call_1, NULL); >> >> void *(*start_routine)(void*) >> >> Here is our man page: >> http://lerami.lerctr.org:8458/en/man/html.3pthread/pthread_create.3pthre >> ad. html > > Yes, that's what I have too. What if you have the functions taking > (void *) rather than void. Does that make the warnings disappear? $ r cc cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl $ ./test_thread Your functions are all thread-safe $ Attached is my modified version. -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Attachment
Larry Rosenman wrote: > > > --On Wednesday, September 03, 2003 16:51:51 -0400 Bruce Momjian > <pgman@candle.pha.pa.us> wrote: > > > Larry Rosenman wrote: > >> > From UnixWare: > >> > >> $ cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl > >> UX:acomp: WARNING: "test_thread.c", line 60: argument #3 incompatible > >> with prototype: pthread_create() > >> UX:acomp: WARNING: "test_thread.c", line 61: argument #3 incompatible > >> with prototype: pthread_create() > >> $ ./test_thread > >> Your functions are all thread-safe > >> $ > > > > Well, that's great news, and so clear too! > > > > I am curious about the compiler warnings. > > > > What does your OS want for the 3rd argument of pthread_create()? I > > thought a void pointer would be OK for everyone: > > > > pthread_create(&thread1, NULL, (void *) func_call_1, NULL); > > void *(*start_routine)(void*) > > Here is our man page: > http://lerami.lerctr.org:8458/en/man/html.3pthread/pthread_create.3pthread. > html Yes, that's what I have too. What if you have the functions taking (void *) rather than void. Does that make the warnings disappear? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
--On Wednesday, September 03, 2003 16:51:51 -0400 Bruce Momjian <pgman@candle.pha.pa.us> wrote: > Larry Rosenman wrote: >> > From UnixWare: >> >> $ cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl >> UX:acomp: WARNING: "test_thread.c", line 60: argument #3 incompatible >> with prototype: pthread_create() >> UX:acomp: WARNING: "test_thread.c", line 61: argument #3 incompatible >> with prototype: pthread_create() >> $ ./test_thread >> Your functions are all thread-safe >> $ > > Well, that's great news, and so clear too! > > I am curious about the compiler warnings. > > What does your OS want for the 3rd argument of pthread_create()? I > thought a void pointer would be OK for everyone: > > pthread_create(&thread1, NULL, (void *) func_call_1, NULL); void *(*start_routine)(void*) Here is our man page: http://lerami.lerctr.org:8458/en/man/html.3pthread/pthread_create.3pthread. html LER -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749
Larry Rosenman wrote: > >> > What does your OS want for the 3rd argument of pthread_create()? I > >> > thought a void pointer would be OK for everyone: > >> > > >> > pthread_create(&thread1, NULL, (void *) func_call_1, NULL); > >> > >> void *(*start_routine)(void*) > >> > >> Here is our man page: > >> http://lerami.lerctr.org:8458/en/man/html.3pthread/pthread_create.3pthre > >> ad. html > > > > Yes, that's what I have too. What if you have the functions taking > > (void *) rather than void. Does that make the warnings disappear? > > $ r cc > cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl > $ ./test_thread > Your functions are all thread-safe > $ I have updated the code to tighten the cast: pthread_create(&thread1, NULL, (void * (*)(void *)) func_call_1, NULL); pthread_create(&thread2, NULL, (void * (*)(void*)) func_call_2, NULL); The change is in CVS. Does that fix it? -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Can you pass me what's in CVS (anon hasn't updated afaict). And, what didn't you like about my version? LER --On Wednesday, September 03, 2003 18:35:44 -0400 Bruce Momjian <pgman@candle.pha.pa.us> wrote: > Larry Rosenman wrote: >> >> > What does your OS want for the 3rd argument of pthread_create()? I >> >> > thought a void pointer would be OK for everyone: >> >> > >> >> > pthread_create(&thread1, NULL, (void *) func_call_1, NULL); >> >> >> >> void *(*start_routine)(void*) >> >> >> >> Here is our man page: >> >> http://lerami.lerctr.org:8458/en/man/html.3pthread/pthread_create.3pt >> >> hre ad. html >> > >> > Yes, that's what I have too. What if you have the functions taking >> > (void *) rather than void. Does that make the warnings disappear? >> >> $ r cc >> cc -O -Kpthread test_thread.c -o test_thread -lsocket -lnsl >> $ ./test_thread >> Your functions are all thread-safe >> $ > > I have updated the code to tighten the cast: > > pthread_create(&thread1, NULL, (void * (*)(void *)) func_call_1, > NULL); pthread_create(&thread2, NULL, (void * (*)(void *)) > func_call_2, NULL); > > The change is in CVS. Does that fix it? -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749