Skip to content

Commit

Permalink
Add os::getThreadId
Browse files Browse the repository at this point in the history
  • Loading branch information
Sainan committed Nov 5, 2024
1 parent cc27f22 commit 6baf9e9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions soup/os.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,15 @@ NAMESPACE_SOUP
#endif
}

pid_t os::getThreadId() noexcept
{
#if SOUP_WINDOWS
return GetCurrentThreadId();
#else
return ::gettid();
#endif
}

#if !SOUP_WINDOWS
void os::sleep(unsigned int ms) noexcept
{
Expand Down
1 change: 1 addition & 0 deletions soup/os.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ NAMESPACE_SOUP
public:

[[nodiscard]] static pid_t getProcessId() noexcept;
[[nodiscard]] static pid_t getThreadId() noexcept;

static void sleep(unsigned int ms) noexcept;

Expand Down

0 comments on commit 6baf9e9

Please sign in to comment.