From ee66c579dedf7130aa4d59afbf373f28c98eead5 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Sat, 14 Apr 2012 10:08:19 +0200 Subject: Report EMFILE/ENFILE from xs_socket() This patch propoagates the error from signaler and mailbox initialisation up the stack. To achieve this signaler and mailbox classes were re-written is C-like syntax. Finally, shutdown_stress test now ignores EMFILE/ENFILE errors. Thus, the tests should pass even on OSX which sets the max number of file descriptors pretty low by default. Signed-off-by: Martin Sustrik --- tests/shutdown_stress.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'tests/shutdown_stress.cpp') diff --git a/tests/shutdown_stress.cpp b/tests/shutdown_stress.cpp index 27ab1f0..f106cc0 100644 --- a/tests/shutdown_stress.cpp +++ b/tests/shutdown_stress.cpp @@ -69,13 +69,18 @@ int XS_TEST_MAIN () for (i = 0; i != THREAD_COUNT; i++) { s2 = xs_socket (ctx, XS_SUB); - assert (s2); - threads [i] = thread_create (shutdown_stress_worker, s2); - assert (threads [i]); + if (!s2 && (errno == EMFILE || errno == ENFILE)) + threads [i] = NULL; + else { + assert (s2); + threads [i] = thread_create (shutdown_stress_worker, s2); + assert (threads [i]); + } } for (i = 0; i != THREAD_COUNT; i++) - thread_join (threads [i]); + if (threads [i]) + thread_join (threads [i]); rc = xs_close (s1); assert (rc == 0); -- cgit v1.2.3