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
4f47cb6d
Commit
4f47cb6d
authored
Dec 11, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid weak-vtables warnings
parent
34706f13
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
4 deletions
+68
-4
examples/curl/curl_fuse.cpp
examples/curl/curl_fuse.cpp
+33
-1
libcaf_core/caf/blocking_actor.hpp
libcaf_core/caf/blocking_actor.hpp
+2
-0
libcaf_core/src/blocking_actor.cpp
libcaf_core/src/blocking_actor.cpp
+4
-0
libcaf_core/src/message_builder.cpp
libcaf_core/src/message_builder.cpp
+6
-0
unit_testing/test_actor_lifetime.cpp
unit_testing/test_actor_lifetime.cpp
+9
-3
unit_testing/test_custom_exception_handler.cpp
unit_testing/test_custom_exception_handler.cpp
+6
-0
unit_testing/test_fixed_stack_actor.cpp
unit_testing/test_fixed_stack_actor.cpp
+8
-0
No files found.
examples/curl/curl_fuse.cpp
View file @
4f47cb6d
...
@@ -101,6 +101,8 @@ class base_actor : public event_based_actor {
...
@@ -101,6 +101,8 @@ class base_actor : public event_based_actor {
// nop
// nop
}
}
~
base_actor
();
inline
actor_ostream
&
print
()
{
inline
actor_ostream
&
print
()
{
return
m_out
<<
m_color
<<
m_name
<<
" (id = "
<<
id
()
<<
"): "
;
return
m_out
<<
m_color
<<
m_name
<<
" (id = "
<<
id
()
<<
"): "
;
}
}
...
@@ -117,6 +119,10 @@ class base_actor : public event_based_actor {
...
@@ -117,6 +119,10 @@ class base_actor : public event_based_actor {
actor_ostream
m_out
;
actor_ostream
m_out
;
};
};
base_actor
::~
base_actor
()
{
// avoid weak-vtables warning
}
// encapsulates an HTTP request
// encapsulates an HTTP request
class
client_job
:
public
base_actor
{
class
client_job
:
public
base_actor
{
public:
public:
...
@@ -125,6 +131,8 @@ class client_job : public base_actor {
...
@@ -125,6 +131,8 @@ class client_job : public base_actor {
// nop
// nop
}
}
~
client_job
();
protected:
protected:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
print
()
<<
"init"
<<
color
::
reset_endl
;
print
()
<<
"init"
<<
color
::
reset_endl
;
...
@@ -149,6 +157,10 @@ class client_job : public base_actor {
...
@@ -149,6 +157,10 @@ class client_job : public base_actor {
}
}
};
};
client_job
::~
client_job
()
{
// avoid weak-vtables warning
}
// spawns HTTP requests
// spawns HTTP requests
class
client
:
public
base_actor
{
class
client
:
public
base_actor
{
public:
public:
...
@@ -158,6 +170,8 @@ class client : public base_actor {
...
@@ -158,6 +170,8 @@ class client : public base_actor {
// nop
// nop
}
}
~
client
();
protected:
protected:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
using
std
::
chrono
::
milliseconds
;
using
std
::
chrono
::
milliseconds
;
...
@@ -185,15 +199,20 @@ class client : public base_actor {
...
@@ -185,15 +199,20 @@ class client : public base_actor {
size_t
m_count
;
size_t
m_count
;
};
};
client
::~
client
()
{
// avoid weak-vtables warning
}
// manages a CURL session
// manages a CURL session
class
curl_worker
:
public
base_actor
{
class
curl_worker
:
public
base_actor
{
public:
public:
curl_worker
(
const
actor
&
parent
)
curl_worker
(
const
actor
&
parent
)
:
base_actor
(
parent
,
"curl_worker"
,
color
::
yellow
)
{
:
base_actor
(
parent
,
"curl_worker"
,
color
::
yellow
)
{
// nop
// nop
}
}
~
curl_worker
();
protected:
protected:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
print
()
<<
"init"
<<
color
::
reset_endl
;
print
()
<<
"init"
<<
color
::
reset_endl
;
...
@@ -275,6 +294,11 @@ class curl_worker : public base_actor {
...
@@ -275,6 +294,11 @@ class curl_worker : public base_actor {
buffer_type
m_buf
;
buffer_type
m_buf
;
};
};
curl_worker
::~
curl_worker
()
{
// avoid weak-vtables warning
}
// manages {num_curl_workers} workers with a round-robin protocol
// manages {num_curl_workers} workers with a round-robin protocol
class
curl_master
:
public
base_actor
{
class
curl_master
:
public
base_actor
{
public:
public:
...
@@ -282,6 +306,8 @@ class curl_master : public base_actor {
...
@@ -282,6 +306,8 @@ class curl_master : public base_actor {
// nop
// nop
}
}
~
curl_master
();
protected:
protected:
behavior
make_behavior
()
override
{
behavior
make_behavior
()
override
{
print
()
<<
"init"
<<
color
::
reset_endl
;
print
()
<<
"init"
<<
color
::
reset_endl
;
...
@@ -337,8 +363,14 @@ class curl_master : public base_actor {
...
@@ -337,8 +363,14 @@ class curl_master : public base_actor {
std
::
vector
<
actor
>
m_busy_worker
;
std
::
vector
<
actor
>
m_busy_worker
;
};
};
curl_master
::~
curl_master
()
{
// avoid weak-vtables warning
}
// signal handling for ctrl+c
// signal handling for ctrl+c
namespace
{
std
::
atomic
<
bool
>
shutdown_flag
{
false
};
std
::
atomic
<
bool
>
shutdown_flag
{
false
};
}
// namespace <anonymous>
int
main
()
{
int
main
()
{
// random number setup
// random number setup
...
...
libcaf_core/caf/blocking_actor.hpp
View file @
4f47cb6d
...
@@ -51,6 +51,8 @@ class blocking_actor
...
@@ -51,6 +51,8 @@ class blocking_actor
blocking_actor
();
blocking_actor
();
~
blocking_actor
();
/**************************************************************************
/**************************************************************************
* utility stuff and receive() member function family *
* utility stuff and receive() member function family *
**************************************************************************/
**************************************************************************/
...
...
libcaf_core/src/blocking_actor.cpp
View file @
4f47cb6d
...
@@ -30,6 +30,10 @@ blocking_actor::blocking_actor() {
...
@@ -30,6 +30,10 @@ blocking_actor::blocking_actor() {
is_blocking
(
true
);
is_blocking
(
true
);
}
}
blocking_actor
::~
blocking_actor
()
{
// avoid weak-vtables warning
}
void
blocking_actor
::
await_all_other_actors_done
()
{
void
blocking_actor
::
await_all_other_actors_done
()
{
detail
::
singletons
::
get_actor_registry
()
->
await_running_count_equal
(
1
);
detail
::
singletons
::
get_actor_registry
()
->
await_running_count_equal
(
1
);
}
}
...
...
libcaf_core/src/message_builder.cpp
View file @
4f47cb6d
...
@@ -46,6 +46,8 @@ class message_builder::dynamic_msg_data : public detail::message_data {
...
@@ -46,6 +46,8 @@ class message_builder::dynamic_msg_data : public detail::message_data {
// nop
// nop
}
}
~
dynamic_msg_data
();
const
void
*
at
(
size_t
pos
)
const
override
{
const
void
*
at
(
size_t
pos
)
const
override
{
CAF_REQUIRE
(
pos
<
size
());
CAF_REQUIRE
(
pos
<
size
());
return
m_elements
[
pos
]
->
val
;
return
m_elements
[
pos
]
->
val
;
...
@@ -76,6 +78,10 @@ class message_builder::dynamic_msg_data : public detail::message_data {
...
@@ -76,6 +78,10 @@ class message_builder::dynamic_msg_data : public detail::message_data {
std
::
vector
<
uniform_value
>
m_elements
;
std
::
vector
<
uniform_value
>
m_elements
;
};
};
message_builder
::
dynamic_msg_data
::~
dynamic_msg_data
()
{
// avoid weak-vtables warning
}
message_builder
::
message_builder
()
{
message_builder
::
message_builder
()
{
init
();
init
();
}
}
...
...
unit_testing/test_actor_lifetime.cpp
View file @
4f47cb6d
...
@@ -9,7 +9,9 @@ using std::cout;
...
@@ -9,7 +9,9 @@ using std::cout;
using
std
::
endl
;
using
std
::
endl
;
using
namespace
caf
;
using
namespace
caf
;
namespace
{
std
::
atomic
<
long
>
s_dudes
;
std
::
atomic
<
long
>
s_dudes
;
}
// namespace <anonymous>
class
dude
:
public
event_based_actor
{
class
dude
:
public
event_based_actor
{
public:
public:
...
@@ -17,9 +19,7 @@ class dude : public event_based_actor {
...
@@ -17,9 +19,7 @@ class dude : public event_based_actor {
++
s_dudes
;
++
s_dudes
;
}
}
~
dude
()
{
~
dude
();
--
s_dudes
;
}
behavior
make_behavior
()
{
behavior
make_behavior
()
{
return
{
return
{
...
@@ -30,6 +30,12 @@ class dude : public event_based_actor {
...
@@ -30,6 +30,12 @@ class dude : public event_based_actor {
}
}
};
};
dude
::~
dude
()
{
// avoid weak-vtables warning
--
s_dudes
;
}
behavior
linking_dude
(
event_based_actor
*
self
,
const
actor
&
other_dude
)
{
behavior
linking_dude
(
event_based_actor
*
self
,
const
actor
&
other_dude
)
{
CAF_CHECKPOINT
();
CAF_CHECKPOINT
();
self
->
trap_exit
(
true
);
self
->
trap_exit
(
true
);
...
...
unit_testing/test_custom_exception_handler.cpp
View file @
4f47cb6d
...
@@ -6,6 +6,7 @@ using namespace caf;
...
@@ -6,6 +6,7 @@ using namespace caf;
class
exception_testee
:
public
event_based_actor
{
class
exception_testee
:
public
event_based_actor
{
public:
public:
~
exception_testee
();
exception_testee
()
{
exception_testee
()
{
set_exception_handler
([](
const
std
::
exception_ptr
&
)
->
optional
<
uint32_t
>
{
set_exception_handler
([](
const
std
::
exception_ptr
&
)
->
optional
<
uint32_t
>
{
return
exit_reason
::
user_defined
+
2
;
return
exit_reason
::
user_defined
+
2
;
...
@@ -20,6 +21,11 @@ class exception_testee : public event_based_actor {
...
@@ -20,6 +21,11 @@ class exception_testee : public event_based_actor {
}
}
};
};
exception_testee
::~
exception_testee
()
{
// avoid weak-vtables warning
}
void
test_custom_exception_handler
()
{
void
test_custom_exception_handler
()
{
auto
handler
=
[](
const
std
::
exception_ptr
&
eptr
)
->
optional
<
uint32_t
>
{
auto
handler
=
[](
const
std
::
exception_ptr
&
eptr
)
->
optional
<
uint32_t
>
{
try
{
try
{
...
...
unit_testing/test_fixed_stack_actor.cpp
View file @
4f47cb6d
...
@@ -41,6 +41,9 @@ class fixed_stack : public sb_actor<fixed_stack> {
...
@@ -41,6 +41,9 @@ class fixed_stack : public sb_actor<fixed_stack> {
}
}
);
);
}
}
~
fixed_stack
();
private:
private:
size_t
max_size
=
10
;
size_t
max_size
=
10
;
std
::
vector
<
int
>
data
;
std
::
vector
<
int
>
data
;
...
@@ -50,6 +53,11 @@ class fixed_stack : public sb_actor<fixed_stack> {
...
@@ -50,6 +53,11 @@ class fixed_stack : public sb_actor<fixed_stack> {
behavior
&
init_state
=
empty
;
behavior
&
init_state
=
empty
;
};
};
fixed_stack
::~
fixed_stack
()
{
// avoid weak-vtables warning
}
void
test_fixed_stack_actor
()
{
void
test_fixed_stack_actor
()
{
scoped_actor
self
;
scoped_actor
self
;
auto
st
=
spawn
<
fixed_stack
>
(
size_t
{
10
});
auto
st
=
spawn
<
fixed_stack
>
(
size_t
{
10
});
...
...
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