20.11
Threads.cpp
Go to the documentation of this file.
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 <common/include/WindowsWrapper.hpp>
14
#elif defined(__APPLE__)
15
#include "AvailabilityMacros.h"
16
#include <sys/syscall.h>
17
#include <sys/time.h>
18
#include <unistd.h>
19
#endif
20
21
namespace
armnnUtils
22
{
23
namespace
Threads
24
{
25
26
int
GetCurrentThreadId
()
27
{
28
#if defined(__linux__)
29
return
static_cast<
int
>
(gettid());
30
#elif defined(_MSC_VER)
31
return ::GetCurrentThreadId
();
32
#elif defined(__APPLE__)
33
uint64_t threadId;
34
int
iRet = pthread_threadid_np(NULL, &threadId);
35
if
(iRet != 0)
36
{
37
return
0;
38
}
39
return
threadId;
40
#endif
41
}
42
43
}
44
}
armnnUtils::Threads::GetCurrentThreadId
int GetCurrentThreadId()
Definition:
Threads.cpp:26
Threads.hpp
armnnUtils
Definition:
DataLayoutIndexed.hpp:13
src
armnnUtils
Threads.cpp
Generated on Wed Nov 25 2020 09:59:12 for ArmNN by
1.8.13