Line data Source code
1 : /********************************************************************************
2 : * Copyright (c) 2026 BMW AG
3 : *
4 : * This program and the accompanying materials are made available under the
5 : * terms of the Apache License Version 2.0 which is available at
6 : * https://www.apache.org/licenses/LICENSE-2.0
7 : *
8 : * SPDX-License-Identifier: Apache-2.0
9 : ********************************************************************************/
10 : #include <cstdint>
11 :
12 : #include <unistd.h>
13 :
14 : #include <middleware/os/TaskIdProvider.h>
15 :
16 : namespace middleware
17 : {
18 : namespace os
19 : {
20 :
21 373 : uint32_t getProcessId()
22 : {
23 373 : pid_t const tid = gettid();
24 : static_assert(sizeof tid <= sizeof(uint32_t), "Size of tid is bigger than sizeof(uint32_t)");
25 373 : return static_cast<uint32_t>(tid);
26 : }
27 :
28 : } // namespace os
29 : } // namespace middleware
|