From 11c209deba1f1ac05053db58660332bdf57bbc32 Mon Sep 17 00:00:00 2001 From: jsiegle <joshs@alleninstitute.org> Date: Mon, 22 Dec 2014 17:31:26 -0800 Subject: [PATCH] Update 'sleep' function for Unix --- Source/Processors/NetworkEvents/NetworkEvents.cpp | 8 ++++++++ Source/Processors/PSTH/TrialCircularBuffer.cpp | 5 +++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/Processors/NetworkEvents/NetworkEvents.cpp b/Source/Processors/NetworkEvents/NetworkEvents.cpp index 6030a0d73..ba1e1c09a 100644 --- a/Source/Processors/NetworkEvents/NetworkEvents.cpp +++ b/Source/Processors/NetworkEvents/NetworkEvents.cpp @@ -30,6 +30,8 @@ const int MAX_MESSAGE_LENGTH = 64000; #ifdef WIN32 #include <windows.h> +#else +#include <unistd.h> #endif StringTS::StringTS() @@ -159,7 +161,13 @@ void NetworkEvents::setNewListeningPort(int port) // first, close existing thread. disable(); // allow some time for thread to quit +#ifdef WIN32 Sleep(300); +#else + usleep(300 * 1000); +#endif + + urlport = port; opensocket(); } diff --git a/Source/Processors/PSTH/TrialCircularBuffer.cpp b/Source/Processors/PSTH/TrialCircularBuffer.cpp index ca68565d7..897f7e469 100644 --- a/Source/Processors/PSTH/TrialCircularBuffer.cpp +++ b/Source/Processors/PSTH/TrialCircularBuffer.cpp @@ -30,10 +30,11 @@ #include "tictoc.h" #ifdef WIN32 #include <windows.h> +#else +#include <unistd.h> #endif -//#include <unistd.h> -TicToc tictoc; +TicToc tictoc; TrialCircularBufferParams::TrialCircularBufferParams() { -- GitLab