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
00cbb5e7
Commit
00cbb5e7
authored
Nov 15, 2014
by
Joseph Noir
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix to use caf thread header
parent
fc5a1ed8
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
12 deletions
+14
-12
libcaf_core/caf/detail/double_ended_queue.hpp
libcaf_core/caf/detail/double_ended_queue.hpp
+2
-2
libcaf_core/caf/scheduler/coordinator.hpp
libcaf_core/caf/scheduler/coordinator.hpp
+5
-4
libcaf_core/caf/scheduler/worker.hpp
libcaf_core/caf/scheduler/worker.hpp
+3
-3
libcaf_core/caf/set_scheduler.hpp
libcaf_core/caf/set_scheduler.hpp
+3
-2
libcaf_io/test/unpublish.cpp
libcaf_io/test/unpublish.cpp
+1
-1
No files found.
libcaf_core/caf/detail/double_ended_queue.hpp
View file @
00cbb5e7
...
...
@@ -24,11 +24,11 @@
#define CAF_CACHE_LINE_SIZE 64
#include <thread>
#include <atomic>
#include <cassert>
#include "caf/chrono.hpp"
#include "caf/thread.hpp"
// GCC hack
#if defined(CAF_GCC) && !defined(_GLIBCXX_USE_SCHED_YIELD)
...
...
@@ -233,7 +233,7 @@ class double_ended_queue {
public:
lock_guard
(
std
::
atomic_flag
&
lock
)
:
m_lock
(
lock
)
{
while
(
lock
.
test_and_set
(
std
::
memory_order_acquire
))
{
std
::
this_thread
::
yield
();
this_thread
::
yield
();
}
}
~
lock_guard
()
{
...
...
libcaf_core/caf/scheduler/coordinator.hpp
View file @
00cbb5e7
...
...
@@ -20,10 +20,11 @@
#ifndef CAF_SCHEDULER_COORDINATOR_HPP
#define CAF_SCHEDULER_COORDINATOR_HPP
#include <thread>
#include <limits>
#include <memory>
#include <condition_variable>
#include "caf/thread.hpp"
#include "caf/condition_variable.hpp"
#include "caf/scheduler/worker.hpp"
#include "caf/scheduler/abstract_coordinator.hpp"
...
...
@@ -41,7 +42,7 @@ class coordinator : public abstract_coordinator {
using
policy_data
=
typename
Policy
::
coordinator_data
;
coordinator
(
size_t
nw
=
std
::
max
(
std
::
thread
::
hardware_concurrency
(),
4u
),
coordinator
(
size_t
nw
=
std
::
max
(
thread
::
hardware_concurrency
(),
4u
),
size_t
mt
=
std
::
numeric_limits
<
size_t
>::
max
())
:
super
(
nw
),
m_max_throughput
(
mt
)
{
...
...
@@ -139,7 +140,7 @@ class coordinator : public abstract_coordinator {
}
private:
// usually of size
std::
thread::hardware_concurrency()
// usually of size thread::hardware_concurrency()
std
::
vector
<
std
::
unique_ptr
<
worker_type
>>
m_workers
;
// policy-specific data
policy_data
m_data
;
...
...
libcaf_core/caf/scheduler/worker.hpp
View file @
00cbb5e7
...
...
@@ -53,7 +53,7 @@ class worker : public execution_unit {
void
start
()
{
CAF_ASSERT
(
m_this_thread
.
get_id
()
==
std
::
thread
::
id
{});
auto
this_worker
=
this
;
m_this_thread
=
std
::
thread
{[
this_worker
]
{
m_this_thread
=
thread
{[
this_worker
]
{
CAF_LOGF_TRACE
(
"id = "
<<
this_worker
->
id
());
this_worker
->
run
();
}};
...
...
@@ -91,7 +91,7 @@ class worker : public execution_unit {
return
m_id
;
}
std
::
thread
&
get_thread
()
{
thread
&
get_thread
()
{
return
m_this_thread
;
}
...
...
@@ -155,7 +155,7 @@ class worker : public execution_unit {
// number of messages each actor is allowed to consume per resume
size_t
m_max_throughput
;
// the worker's thread
std
::
thread
m_this_thread
;
thread
m_this_thread
;
// the worker's ID received from scheduler
size_t
m_id
;
// pointer to central coordinator
...
...
libcaf_core/caf/set_scheduler.hpp
View file @
00cbb5e7
...
...
@@ -20,9 +20,10 @@
#ifndef CAF_SET_SCHEDULER_HPP
#define CAF_SET_SCHEDULER_HPP
#include <thread>
#include <limits>
#include "caf/thread.hpp"
#include "caf/policy/work_stealing.hpp"
#include "caf/scheduler/worker.hpp"
...
...
@@ -48,7 +49,7 @@ void set_scheduler(scheduler::abstract_coordinator* ptr);
* @throws std::invalid_argument if `max_throughput == 0`
*/
template
<
class
Policy
=
policy
::
work_stealing
>
void
set_scheduler
(
size_t
nw
=
std
::
thread
::
hardware_concurrency
(),
void
set_scheduler
(
size_t
nw
=
thread
::
hardware_concurrency
(),
size_t
max_throughput
=
std
::
numeric_limits
<
size_t
>::
max
())
{
if
(
max_throughput
==
0
)
{
throw
std
::
invalid_argument
(
"max_throughput must not be 0"
);
...
...
libcaf_io/test/unpublish.cpp
View file @
00cbb5e7
...
...
@@ -20,10 +20,10 @@
#define CAF_SUITE unpublish
#include "caf/test/unit_test.hpp"
#include <thread>
#include <atomic>
#include "caf/all.hpp"
#include "caf/thread.hpp"
#include "caf/io/all.hpp"
using
namespace
caf
;
...
...
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