Windows porting: port hyperscan and chimera tools to windows.

This commit is contained in:
Lu, Qi
2018-05-08 12:05:44 -04:00
committed by Wang, Xiang W
parent bf87f8c003
commit 5a0885d235
34 changed files with 563 additions and 109 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, Intel Corporation
* Copyright (c) 2015-2018, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
@@ -35,8 +35,7 @@
#include <cstdlib>
#include <iostream>
#include <pthread.h>
#ifndef _WIN32
static const size_t COLLIDER_THREAD_STACK_SIZE = 8192 * 1024;
void Thread::start() {
@@ -79,6 +78,16 @@ create_thread:
}
}
void Thread::join() { pthread_join(thread, nullptr); }
#else // windows
void Thread::start() { thread = std::thread(&runThread, this); }
void Thread::join() { thread.join(); }
#endif
// Dispatch
void *Thread::runThread(void *thr) {
if (!no_signal_handler) {
@@ -88,7 +97,6 @@ void *Thread::runThread(void *thr) {
return nullptr;
}
void Thread::join() { pthread_join(thread, nullptr); }
Thread::Thread(size_t num) : thread_id(num) {}