diff options
author | Jake Farrell <jfarrell@apache.org> | 2014-01-07 21:42:01 -0500 |
---|---|---|
committer | Jake Farrell <jfarrell@apache.org> | 2014-01-07 21:42:01 -0500 |
commit | 5d02b80e9cde00280cbac5c17cc3843806ec9436 (patch) | |
tree | 4b12b2e6816154fdbd2d6273732ca90a5ae2904d /test/threads | |
parent | 05f37f1917bfa89d5862e4e45896bc6e28d8fa51 (diff) | |
download | thrift-5d02b80e9cde00280cbac5c17cc3843806ec9436.tar.gz |
Thrift-2029:Port C++ tests to Windows
Client: cpp
Patch: Ben Craig
Updates cpp tests to work with windows and c++11
Diffstat (limited to 'test/threads')
-rw-r--r-- | test/threads/ThreadsClient.cpp | 6 | ||||
-rw-r--r-- | test/threads/ThreadsServer.cpp | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/test/threads/ThreadsClient.cpp b/test/threads/ThreadsClient.cpp index 70b08ad8d..9306a3f25 100644 --- a/test/threads/ThreadsClient.cpp +++ b/test/threads/ThreadsClient.cpp @@ -28,6 +28,9 @@ #include <thrift/concurrency/Monitor.h> #include <thrift/concurrency/ThreadManager.h> #include <thrift/concurrency/PlatformThreadFactory.h> +#if _WIN32 + #include <thrift/windows/TWinsockSingleton.h> +#endif using boost::shared_ptr; using namespace apache::thrift; @@ -37,6 +40,9 @@ using namespace apache::thrift::server; using namespace apache::thrift::concurrency; int main(int argc, char **argv) { +#if _WIN32 + transport::TWinsockSingleton::create(); +#endif int port = 9090; std::string host = "localhost"; diff --git a/test/threads/ThreadsServer.cpp b/test/threads/ThreadsServer.cpp index 9c1a7d974..a267c3b90 100644 --- a/test/threads/ThreadsServer.cpp +++ b/test/threads/ThreadsServer.cpp @@ -29,6 +29,9 @@ #include <thrift/concurrency/Monitor.h> #include <thrift/concurrency/ThreadManager.h> #include <thrift/concurrency/PlatformThreadFactory.h> +#if _WIN32 + #include <thrift/windows/TWinsockSingleton.h> +#endif using boost::shared_ptr; using namespace apache::thrift; @@ -85,11 +88,12 @@ class ThreadsTestHandler : virtual public ThreadsTestIf { protected: void go2sleep(int thread, int seconds) { Monitor m; + Synchronized s(m); for (int i = 0; i < seconds; ++i) { fprintf(stderr, "Thread %d: sleep %d\n", thread, i); try { m.wait(1000); - } catch(TimedOutException& e) { + } catch(const TimedOutException&) { } } fprintf(stderr, "THREAD %d DONE\n", thread); @@ -101,6 +105,9 @@ private: }; int main(int argc, char **argv) { +#if _WIN32 + transport::TWinsockSingleton::create(); +#endif int port = 9090; shared_ptr<ThreadsTestHandler> handler(new ThreadsTestHandler()); shared_ptr<TProcessor> processor(new ThreadsTestProcessor(handler)); |