Jim Flynn | 1fdeb99 | 2020-07-09 07:28:37 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd and Contributors. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include "Threads.hpp" |
| 7 | |
| 8 | #if defined(__linux__) |
| 9 | #include <unistd.h> |
| 10 | #include <sys/syscall.h> |
| 11 | #define gettid() syscall(SYS_gettid) |
| 12 | #elif defined(_MSC_VER) |
| 13 | #include "WindowsWrapper.hpp" |
| 14 | #endif |
| 15 | |
| 16 | namespace armnnUtils |
| 17 | { |
| 18 | namespace Threads |
| 19 | { |
| 20 | |
| 21 | int GetCurrentThreadId() |
| 22 | { |
| 23 | #if defined(__linux__) |
| 24 | return static_cast<int>(gettid()); |
| 25 | #elif defined(_MSC_VER) |
| 26 | return ::GetCurrentThreadId(); |
| 27 | #endif |
| 28 | } |
| 29 | |
| 30 | } |
| 31 | } |