diff options
author | Martin Sustrik <sustrik@250bpm.cpm> | 2012-02-16 10:06:30 +0900 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2012-02-16 10:06:30 +0900 |
commit | fb1209c72bbfd431b61fa4588785586d24ef67c9 (patch) | |
tree | 6c33ac55809c64e57e44b347879fe297e894be5e /tests/shutdown_stress.cpp | |
parent | 0d384b7944c20f3389c2be9363afac99783d776a (diff) |
More MSVC tests added
Signed-off-by: Martin Sustrik <sustrik@250bpm.cpm>
Diffstat (limited to 'tests/shutdown_stress.cpp')
-rw-r--r-- | tests/shutdown_stress.cpp | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/tests/shutdown_stress.cpp b/tests/shutdown_stress.cpp index 2e6b4d5..976c658 100644 --- a/tests/shutdown_stress.cpp +++ b/tests/shutdown_stress.cpp @@ -21,32 +21,20 @@ #include "testutil.hpp" -#if defined XS_HAVE_WINDOWS -int XS_TEST_MAIN () -{ - return 0; -} -#else - -#include <pthread.h> -#include <stddef.h> - #define THREAD_COUNT 100 extern "C" { - static void *worker (void *s) + static void shutdown_stress_worker (void *s_) { int rc; - rc = xs_connect (s, "tcp://127.0.0.1:5560"); + rc = xs_connect (s_, "tcp://127.0.0.1:5560"); assert (rc == 0); // Start closing the socket while the connecting process is underway. - rc = xs_close (s); + rc = xs_close (s_); assert (rc == 0); - - return NULL; } } @@ -58,7 +46,7 @@ int XS_TEST_MAIN () int i; int j; int rc; - pthread_t threads [THREAD_COUNT]; + void *threads [THREAD_COUNT]; fprintf (stderr, "shutdown_stress test running...\n"); @@ -77,14 +65,12 @@ int XS_TEST_MAIN () for (i = 0; i != THREAD_COUNT; i++) { s2 = xs_socket (ctx, XS_SUB); assert (s2); - rc = pthread_create (&threads [i], NULL, worker, s2); - assert (rc == 0); + threads [i] = xs_thread_create (shutdown_stress_worker, s2); + assert (threads [i]); } - for (i = 0; i != THREAD_COUNT; i++) { - rc = pthread_join (threads [i], NULL); - assert (rc == 0); - } + for (i = 0; i != THREAD_COUNT; i++) + xs_thread_join (threads [i]); rc = xs_close (s1); assert (rc == 0); @@ -95,5 +81,3 @@ int XS_TEST_MAIN () return 0; } - -#endif
\ No newline at end of file |