diff options
| author | Martin Sustrik <sustrik@250bpm.com> | 2010-11-27 22:19:43 +0100 | 
|---|---|---|
| committer | Martin Sustrik <sustrik@250bpm.com> | 2010-11-27 22:19:43 +0100 | 
| commit | 325dd2f0914de502ae7687f94927fa98c20380c9 (patch) | |
| tree | 8007a7b66e37afadfc737a819150a507e723bc25 /src/thread.cpp | |
| parent | 0bc2a05d84dc8e496a60d0c8def7689783e08e01 (diff) | |
Functions passed to pthread_create are declared as extern "C"
So far these were declared as C++ static functions which
was incorrect and caused warnings with SunStudio.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/thread.cpp')
| -rw-r--r-- | src/thread.cpp | 54 | 
1 files changed, 30 insertions, 24 deletions
diff --git a/src/thread.cpp b/src/thread.cpp index 2edd85b..874190e 100644 --- a/src/thread.cpp +++ b/src/thread.cpp @@ -23,6 +23,16 @@  #ifdef ZMQ_HAVE_WINDOWS +extern "C" +{ +    static unsigned int __stdcall thread_routine (void *arg_) +    { +        thread_t *self = (zmq::thread_t*) arg_; +        self->tfn (self->arg); +        return 0; +    } +} +  void zmq::thread_t::start (thread_fn *tfn_, void *arg_)  {      tfn = tfn_; @@ -38,17 +48,30 @@ void zmq::thread_t::stop ()      win_assert (rc != WAIT_FAILED);  } -unsigned int __stdcall zmq::thread_t::thread_routine (void *arg_) -{ -    thread_t *self = (thread_t*) arg_; -    self->tfn (self->arg); -    return 0; -} -  #else  #include <signal.h> +extern "C" +{ +    static void *thread_routine (void *arg_) +    { +    #if !defined ZMQ_HAVE_OPENVMS +        //  Following code will guarantee more predictable latecnies as it'll +        //  disallow any signal handling in the I/O thread. +        sigset_t signal_set; +        int rc = sigfillset (&signal_set); +        errno_assert (rc == 0); +        rc = pthread_sigmask (SIG_BLOCK, &signal_set, NULL); +        errno_assert (rc == 0); +    #endif + +        zmq::thread_t *self = (zmq::thread_t*) arg_;    +        self->tfn (self->arg); +        return NULL; +    } +} +  void zmq::thread_t::start (thread_fn *tfn_, void *arg_)  {      tfn = tfn_; @@ -63,23 +86,6 @@ void zmq::thread_t::stop ()      errno_assert (rc == 0);  } -void *zmq::thread_t::thread_routine (void *arg_) -{ -#if !defined ZMQ_HAVE_OPENVMS -    //  Following code will guarantee more predictable latecnies as it'll -    //  disallow any signal handling in the I/O thread. -    sigset_t signal_set; -    int rc = sigfillset (&signal_set); -    errno_assert (rc == 0); -    rc = pthread_sigmask (SIG_BLOCK, &signal_set, NULL); -    errno_assert (rc == 0); -#endif - -    thread_t *self = (thread_t*) arg_;    -    self->tfn (self->arg); -    return NULL; -} -  #endif  | 
