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
3799bc11
Commit
3799bc11
authored
May 27, 2017
by
Dominik Charousset
Committed by
GitHub
May 27, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #558
remove OSX/Clang specific pthread code
parents
ab759571
94f2fb53
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
17 deletions
+22
-17
libcaf_core/caf/config.hpp
libcaf_core/caf/config.hpp
+3
-0
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+14
-14
libcaf_core/src/memory.cpp
libcaf_core/src/memory.cpp
+5
-3
No files found.
libcaf_core/caf/config.hpp
View file @
3799bc11
...
...
@@ -101,6 +101,9 @@
# define CAF_ANNOTATE_FALLTHROUGH [[clang::fallthrough]]
# define CAF_COMPILER_VERSION \
(__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
# if !__has_feature(cxx_thread_local)
# define CAF_NO_THREAD_LOCAL
# endif
#elif defined(__GNUC__)
# define CAF_GCC
# define CAF_DEPRECATED __attribute__((__deprecated__))
...
...
libcaf_core/src/logger.cpp
View file @
3799bc11
...
...
@@ -62,19 +62,7 @@ constexpr const char* log_level_name[] = {
static_assert
(
CAF_LOG_LEVEL
>=
0
&&
CAF_LOG_LEVEL
<=
4
,
"assertion: 0 <= CAF_LOG_LEVEL <= 4"
);
#ifdef CAF_MSVC
thread_local
intrusive_ptr
<
logger
>
current_logger
;
inline
void
set_current_logger
(
logger
*
x
)
{
current_logger
.
reset
(
x
);
}
inline
logger
*
get_current_logger
()
{
return
current_logger
.
get
();
}
#else // CAF_MSVC
#if defined(CAF_NO_THREAD_LOCAL)
pthread_key_t
s_key
;
pthread_once_t
s_key_once
=
PTHREAD_ONCE_INIT
;
...
...
@@ -102,7 +90,19 @@ logger* get_current_logger() {
return
reinterpret_cast
<
logger
*>
(
pthread_getspecific
(
s_key
));
}
#endif // CAF_MSVC
#else // !CAF_NO_THREAD_LOCAL
thread_local
intrusive_ptr
<
logger
>
current_logger
;
inline
void
set_current_logger
(
logger
*
x
)
{
current_logger
.
reset
(
x
);
}
inline
logger
*
get_current_logger
()
{
return
current_logger
.
get
();
}
#endif // CAF_NO_THREAD_LOCAL
#else // CAF_LOG_LEVEL
...
...
libcaf_core/src/memory.cpp
View file @
3799bc11
...
...
@@ -17,6 +17,7 @@
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#include "caf/config.hpp"
#include "caf/detail/memory.hpp"
#include <vector>
...
...
@@ -43,7 +44,8 @@ using cache_map = std::map<const std::type_info*, std::unique_ptr<memory_cache>>
}
// namespace <anonymous>
#if defined(CAF_CLANG) || defined(CAF_MACOS)
#if defined(CAF_NO_THREAD_LOCAL)
namespace
{
pthread_key_t
s_key
;
...
...
@@ -72,7 +74,7 @@ cache_map& get_cache_map() {
return
*
cache
;
}
#else // !CAF_
CLANG && !CAF_MACOS
#else // !CAF_
NO_THREAD_LOCAL
namespace
{
...
...
@@ -90,7 +92,7 @@ cache_map& get_cache_map() {
return
*
s_key
;
}
#endif
#endif
// !CAF_NO_THREAD_LOCAL
memory_cache
::~
memory_cache
()
{
// nop
...
...
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