[zeromq-dev] platform checks.

George Neill georgen at neillnet.com
Wed Nov 12 17:46:40 CET 2008


Martin,

On Wed, Nov 12, 2008 at 8:31 AM, Martin Sustrik <sustrik at fastmq.com> wrote:
> George,
>
> Related issue (ZMQ-104) is solved. POSIX semaphores are made default with
> specific optimisations for Linux, OS X and Windows platform.

This should be changed as well,

in ysemaphore.h

#ifdef ZMQ_HAVE_WINDOWS
#include <windows.h>
#elif (defined ZMQ_HAVE_FREEBSD || defined ZMQ_HAVE_SOLARIS ||\
    defined ZMQ_HAVE_OPENBSD || defined ZMQ_HAVE_QNXNTO)
#include <semaphore.h>
#else
#include <pthread.h>
#endif

to

#if (defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_OSX)
#include <pthread.h>
#elif defined ZMQ_HAVE_WINDOWS
#include <windows.h>
#else // default
#include <semaphore.h>
#endif

> Together with ZMQ-103 (don't use MSG_DONTWAIT) this should solve your
> problems when porting to AIX and HP-UX. Let us know whether everything
> builds OK now.

Sure, I will test.   It looks like theres a harmless new bug introduced!

>>>>>>            int flags;    <<<<<<
#if defined ZMQ_HAVE_LINUX || defined ZMQ_HAVE_OSX || defined ZMQ_HAVE_SOLARIS \
    || defined ZMQ_HAVE_FREEBSD  || defined ZMQ_HAVE_OPENBSD  \
    || defined ZMQ_HAVE_QNXNTO

            if (-1 == (flags = fcntl (r, F_GETFL, 0)))
                flags = 0;

            //  Set to non-blocking mode.
            rc = fcntl (r, F_SETFL, flags | O_NONBLOCK);
            errno_assert (rc != -1);

#elif
#error nonblocking sockets not supported on this platform
#endif

I felt the #ifdef O_NONBLOCK check was better for ZMQ-103

Thanks much,
George.



More information about the zeromq-dev mailing list