Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
8f328ae5
Commit
8f328ae5
authored
May 19, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add get_process_id utility function
parent
5da4203c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
83 additions
and
7 deletions
+83
-7
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+1
-0
libcaf_core/caf/detail/get_process_id.hpp
libcaf_core/caf/detail/get_process_id.hpp
+35
-0
libcaf_core/src/get_process_id.cpp
libcaf_core/src/get_process_id.cpp
+43
-0
libcaf_core/src/node_id.cpp
libcaf_core/src/node_id.cpp
+4
-7
No files found.
libcaf_core/CMakeLists.txt
View file @
8f328ae5
...
@@ -50,6 +50,7 @@ set (LIBCAF_CORE_SRCS
...
@@ -50,6 +50,7 @@ set (LIBCAF_CORE_SRCS
src/exit_reason.cpp
src/exit_reason.cpp
src/forwarding_actor_proxy.cpp
src/forwarding_actor_proxy.cpp
src/get_mac_addresses.cpp
src/get_mac_addresses.cpp
src/get_process_id.cpp
src/get_root_uuid.cpp
src/get_root_uuid.cpp
src/group.cpp
src/group.cpp
src/group_manager.cpp
src/group_manager.cpp
...
...
libcaf_core/caf/detail/get_process_id.hpp
0 → 100644
View file @
8f328ae5
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_DETAIL_GET_PROCESS_ID_HPP
#define CAF_DETAIL_GET_PROCESS_ID_HPP
#include <string>
#include <vector>
#include <utility>
namespace
caf
{
namespace
detail
{
unsigned
get_process_id
();
}
// namespace detail
}
// namespace caf
#endif // CAF_DETAIL_GET_PROCESS_ID_HPP
libcaf_core/src/get_process_id.cpp
0 → 100644
View file @
8f328ae5
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/detail/get_process_id.hpp"
#include "caf/config.hpp"
#ifdef CAF_WINDOWS
# include <Windows.h>
#else
# include <sys/types.h>
# include <unistd.h>
#endif
namespace
caf
{
namespace
detail
{
unsigned
get_process_id
()
{
# ifdef CAF_WINDOWS
return
GetCurrentProcessId
();
# else
return
static_cast
<
unsigned
>
(
getpid
());
# endif
}
}
// namespace detail
}
// namespace caf
libcaf_core/src/node_id.cpp
View file @
8f328ae5
...
@@ -21,9 +21,6 @@
...
@@ -21,9 +21,6 @@
#include <cstring>
#include <cstring>
#include <sstream>
#include <sstream>
#include <unistd.h>
#include <sys/types.h>
#include "caf/config.hpp"
#include "caf/config.hpp"
#include "caf/node_id.hpp"
#include "caf/node_id.hpp"
#include "caf/serializer.hpp"
#include "caf/serializer.hpp"
...
@@ -36,6 +33,7 @@
...
@@ -36,6 +33,7 @@
#include "caf/detail/ripemd_160.hpp"
#include "caf/detail/ripemd_160.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/safe_equal.hpp"
#include "caf/detail/get_root_uuid.hpp"
#include "caf/detail/get_root_uuid.hpp"
#include "caf/detail/get_process_id.hpp"
#include "caf/detail/get_mac_addresses.hpp"
#include "caf/detail/get_mac_addresses.hpp"
namespace
caf
{
namespace
caf
{
...
@@ -165,7 +163,7 @@ node_id::data::~data() {
...
@@ -165,7 +163,7 @@ node_id::data::~data() {
}
}
void
node_id
::
data
::
stop
()
{
void
node_id
::
data
::
stop
()
{
// nop
CAF_LOG_TRACE
(
""
);
}
}
// initializes singleton
// initializes singleton
...
@@ -180,9 +178,8 @@ node_id::data* node_id::data::create_singleton() {
...
@@ -180,9 +178,8 @@ node_id::data* node_id::data::create_singleton() {
auto
hd_serial_and_mac_addr
=
join
(
macs
,
""
)
+
detail
::
get_root_uuid
();
auto
hd_serial_and_mac_addr
=
join
(
macs
,
""
)
+
detail
::
get_root_uuid
();
node_id
::
host_id_type
nid
;
node_id
::
host_id_type
nid
;
detail
::
ripemd_160
(
nid
,
hd_serial_and_mac_addr
);
detail
::
ripemd_160
(
nid
,
hd_serial_and_mac_addr
);
auto
ptr
=
make_counted
<
node_id
::
data
>
(
static_cast
<
uint32_t
>
(
getpid
()),
nid
);
// note: pointer has a ref count of 1 -> implicitly held by detail::singletons
// note: ptr has a ref count of 1 -> implicitly held by detail::singletons
return
new
node_id
::
data
(
detail
::
get_process_id
(),
nid
);
return
ptr
.
release
();
}
}
uint32_t
node_id
::
process_id
()
const
{
uint32_t
node_id
::
process_id
()
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment