diff --git a/include/hermes/SerialExecutor/SerialExecutor.h b/include/hermes/Support/SerialExecutor.h similarity index 100% rename from include/hermes/SerialExecutor/SerialExecutor.h rename to include/hermes/Support/SerialExecutor.h diff --git a/lib/SerialExecutor/CMakeLists.txt b/lib/SerialExecutor/CMakeLists.txt deleted file mode 100644 index 7583aadec6d..00000000000 --- a/lib/SerialExecutor/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -add_hermes_library(hermesSerialExecutor SerialExecutor.cpp) -target_compile_options(hermesSerialExecutor PRIVATE -frtti -fexceptions) diff --git a/lib/Support/CMakeLists.txt b/lib/Support/CMakeLists.txt index 6cffb4531b2..13d04422b19 100644 --- a/lib/Support/CMakeLists.txt +++ b/lib/Support/CMakeLists.txt @@ -27,6 +27,7 @@ add_hermes_library(hermesSupport PageAccessTrackerPosix.cpp PerfSection.cpp SemaphorePosix.cpp + SerialExecutor.cpp SHA1.cpp SNPrintfBuf.cpp SourceErrorManager.cpp diff --git a/lib/SerialExecutor/SerialExecutor.cpp b/lib/Support/SerialExecutor.cpp similarity index 87% rename from lib/SerialExecutor/SerialExecutor.cpp rename to lib/Support/SerialExecutor.cpp index 51aa5a0e6dd..f1feafb7941 100644 --- a/lib/SerialExecutor/SerialExecutor.cpp +++ b/lib/Support/SerialExecutor.cpp @@ -5,7 +5,9 @@ * LICENSE file in the root directory of this source tree. */ -#include "hermes/SerialExecutor/SerialExecutor.h" +#include + +#include "hermes/Support/SerialExecutor.h" namespace hermes { @@ -14,22 +16,18 @@ SerialExecutor::SerialExecutor(size_t stackSize) { pthread_attr_t attr; int ret; + (void)ret; ret = pthread_attr_init(&attr); - if (ret != 0) { - throw std::runtime_error("Failed pthread_attr_init"); - } + assert(ret == 0 && "Failed pthread_attr_init"); if (stackSize != 0) { ret = pthread_attr_setstacksize(&attr, stackSize); - if (ret != 0) { - throw std::runtime_error("Failed pthread_attr_setstacksize"); - } + assert(ret == 0 && "Failed pthread_attr_setstacksize"); } ret = pthread_create(&tid_, &attr, SerialExecutor::threadMain, this); - if (ret != 0) { - throw std::runtime_error("Failed pthread_create"); - } + assert(ret == 0 && "Failed pthread_create"); + #else workerThread_ = std::thread([this]() { this->run(); }); #endif diff --git a/tools/hcdp/CMakeLists.txt b/tools/hcdp/CMakeLists.txt index 7747e60430c..8c0e8e4021c 100644 --- a/tools/hcdp/CMakeLists.txt +++ b/tools/hcdp/CMakeLists.txt @@ -28,7 +28,7 @@ add_hermes_tool(hcdp ${ALL_HEADER_FILES} ) -target_link_libraries(hcdp hermesSerialExecutor libhermes hermesParser) +target_link_libraries(hcdp hermesSupport libhermes hermesParser) install(TARGETS hcdp RUNTIME DESTINATION bin diff --git a/tools/hcdp/hcdp.cpp b/tools/hcdp/hcdp.cpp index cc06362b6e4..caab79259cd 100644 --- a/tools/hcdp/hcdp.cpp +++ b/tools/hcdp/hcdp.cpp @@ -22,8 +22,8 @@ int main(void) { #include #include -#include #include +#include #include #include #include diff --git a/unittests/API/AsyncDebuggerAPITest.cpp b/unittests/API/AsyncDebuggerAPITest.cpp index c966529a9d7..0808717103c 100644 --- a/unittests/API/AsyncDebuggerAPITest.cpp +++ b/unittests/API/AsyncDebuggerAPITest.cpp @@ -14,7 +14,7 @@ #include #include -#include +#include #include #include diff --git a/unittests/API/CDPAgentTest.cpp b/unittests/API/CDPAgentTest.cpp index fbb6a6201cf..2fce14d1861 100644 --- a/unittests/API/CDPAgentTest.cpp +++ b/unittests/API/CDPAgentTest.cpp @@ -15,8 +15,8 @@ #include #include -#include #include +#include #include #include #include