[Openswan dev] warning? (fwd)

D. Hugh Redelmeier hugh at mimosa.com
Mon Jan 25 15:28:07 EST 2010


| From: Paul Wouters <paul at xelerance.com>

| From: D. Hugh Redelmeier <hugh at mimosa.com>

| > I don't know the code.

To be clearer: I only looked at what was in the diff.  I didn't
consult the source files at all.  Lazy.

| It seems that pthread_create() wants a (void *)
| 
|        int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
|                            void *(*start_routine) (void *), void *arg);
| 
| Since pluto_helper_thread() is used as the 3rd arg in pthread_create(), I guess
| we are stuck with (void *) and the somewhat ugly "return NULL" ?

Reading the man page of pthread_create(3), it turns out that a return
from the start_routie is equivalent to calling pthread_exit(3).  The
result returned is used the same way as the parameter to pthread_exit.

It seems likely that NULL is fine.  The idea is that this value "(if
the thread is joinable) is available to another thread in the same
process that calls pthread_join(3)."  I would guess that there are no
pthread_joins, but I have not checked.


More information about the Dev mailing list