LCOV - code coverage report
Current view: top level - source/common/thread - terminate_thread.cc (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 0 5 0.0 %
Date: 2024-01-05 06:35:25 Functions: 0 2 0.0 %

          Line data    Source code
       1             : #include "source/common/thread/terminate_thread.h"
       2             : 
       3             : #include <sys/types.h>
       4             : 
       5             : #include <csignal>
       6             : 
       7             : #include "source/common/common/logger.h"
       8             : 
       9             : namespace Envoy {
      10             : namespace Thread {
      11             : namespace {
      12             : #ifdef __linux__
      13           0 : pid_t toPlatformTid(int64_t tid) { return static_cast<pid_t>(tid); }
      14             : #elif defined(__APPLE__)
      15             : uint64_t toPlatformTid(int64_t tid) { return static_cast<uint64_t>(tid); }
      16             : #endif
      17             : } // namespace
      18             : 
      19           0 : bool terminateThread(const ThreadId& tid) {
      20           0 : #ifndef WIN32
      21             :   // Assume POSIX-compatible system and signal to the thread.
      22           0 :   return kill(toPlatformTid(tid.getId()), SIGABRT) == 0;
      23             : #else
      24             :   // Windows, currently unsupported termination of thread.
      25             :   ENVOY_LOG_MISC(error, "Windows is currently unsupported for terminateThread.");
      26             :   return false;
      27             : #endif
      28           0 : }
      29             : 
      30             : } // namespace Thread
      31             : } // namespace Envoy

Generated by: LCOV version 1.15