mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-08 14:56:14 +01:00
Pull request to merge porting to WindRiver VxWorks 6.x (#2966)
* Problem: Still need to port over more files to VxWorks 6.x Solution: Port more files to VxWorks 6.x * Problem: Need to port over remaining files to VxWorks 6.x. Also remove POSIX thread dependency for VxWorks (because of priority inversion problem in POSIX mutexes with VxWorks 6.x processes) Solution: Port over remaining files to VxWorks 6.x. Also removed POSIX thread dependency for VxWorks * Problem: Needed to modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x. Solution: Modify TCP, UDP, TIPC classes with #ifdefs to be compatible with VxWorks 6.x
This commit is contained in:
committed by
Luca Boccassi
parent
0d23b5ca69
commit
4726f7262d
@@ -53,6 +53,11 @@
|
||||
#elif defined ZMQ_HAVE_OPENVMS
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#elif defined ZMQ_HAVE_VXWORKS
|
||||
#include <sys/types.h>
|
||||
#include <sys/time.h>
|
||||
#include <sockLib.h>
|
||||
#include <strings.h>
|
||||
#else
|
||||
#include <sys/select.h>
|
||||
#endif
|
||||
@@ -87,6 +92,11 @@ static int sleep_ms (unsigned int ms_)
|
||||
#elif defined ZMQ_HAVE_ANDROID
|
||||
usleep (ms_ * 1000);
|
||||
return 0;
|
||||
#elif defined ZMQ_HAVE_VXWORKS
|
||||
struct timespec ns_;
|
||||
ns_.tv_sec = ms_ / 1000;
|
||||
ns_.tv_nsec = ms_ % 1000 * 1000000;
|
||||
return nanosleep (&ns_, 0);
|
||||
#else
|
||||
return usleep (ms_ * 1000);
|
||||
#endif
|
||||
@@ -194,6 +204,22 @@ void zmq::signaler_t::send ()
|
||||
zmq_assert (nbytes == sizeof (dummy));
|
||||
break;
|
||||
}
|
||||
#elif defined ZMQ_HAVE_VXWORKS
|
||||
unsigned char dummy = 0;
|
||||
while (true) {
|
||||
ssize_t nbytes = ::send (w, (char *) &dummy, sizeof (dummy), 0);
|
||||
if (unlikely (nbytes == -1 && errno == EINTR))
|
||||
continue;
|
||||
#if defined(HAVE_FORK)
|
||||
if (unlikely (pid != getpid ())) {
|
||||
//printf("Child process %d signaler_t::send returning without sending #2\n", getpid());
|
||||
errno = EINTR;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
zmq_assert (nbytes == sizeof dummy);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
unsigned char dummy = 0;
|
||||
while (true) {
|
||||
@@ -305,6 +331,9 @@ void zmq::signaler_t::recv ()
|
||||
#if defined ZMQ_HAVE_WINDOWS
|
||||
int nbytes = ::recv (r, (char *) &dummy, sizeof (dummy), 0);
|
||||
wsa_assert (nbytes != SOCKET_ERROR);
|
||||
#elif defined ZMQ_HAVE_VXWORKS
|
||||
ssize_t nbytes = ::recv (r, (char *) &dummy, sizeof (dummy), 0);
|
||||
errno_assert (nbytes >= 0);
|
||||
#else
|
||||
ssize_t nbytes = ::recv (r, &dummy, sizeof (dummy), 0);
|
||||
errno_assert (nbytes >= 0);
|
||||
@@ -349,6 +378,16 @@ int zmq::signaler_t::recv_failable ()
|
||||
}
|
||||
wsa_assert (last_error == WSAEWOULDBLOCK);
|
||||
}
|
||||
#elif defined ZMQ_HAVE_VXWORKS
|
||||
ssize_t nbytes = ::recv (r, (char *) &dummy, sizeof (dummy), 0);
|
||||
if (nbytes == -1) {
|
||||
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) {
|
||||
errno = EAGAIN;
|
||||
return -1;
|
||||
}
|
||||
errno_assert (errno == EAGAIN || errno == EWOULDBLOCK
|
||||
|| errno == EINTR);
|
||||
}
|
||||
#else
|
||||
ssize_t nbytes = ::recv (r, &dummy, sizeof (dummy), 0);
|
||||
if (nbytes == -1) {
|
||||
|
||||
Reference in New Issue
Block a user