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
6fb94bd4
Commit
6fb94bd4
authored
Feb 19, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added command_dispatcher to singletons
parent
e307aec7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletion
+27
-1
cppa/detail/singleton_manager.hpp
cppa/detail/singleton_manager.hpp
+4
-0
cppa/opencl/command_dispatcher.hpp
cppa/opencl/command_dispatcher.hpp
+15
-1
src/singleton_manager.cpp
src/singleton_manager.cpp
+8
-0
No files found.
cppa/detail/singleton_manager.hpp
View file @
6fb94bd4
...
@@ -43,6 +43,8 @@ class msg_content;
...
@@ -43,6 +43,8 @@ class msg_content;
namespace
cppa
{
namespace
network
{
class
middleman
;
}
}
namespace
cppa
{
namespace
network
{
class
middleman
;
}
}
namespace
cppa
{
namespace
opencl
{
class
command_dispatcher
;
}
}
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
class
empty_tuple
;
class
empty_tuple
;
...
@@ -80,6 +82,8 @@ class singleton_manager {
...
@@ -80,6 +82,8 @@ class singleton_manager {
static
decorated_names_map
*
get_decorated_names_map
();
static
decorated_names_map
*
get_decorated_names_map
();
static
opencl
::
command_dispatcher
*
get_command_dispatcher
();
private:
private:
/**
/**
...
...
cppa/opencl/command_dispatcher.hpp
View file @
6fb94bd4
...
@@ -32,14 +32,28 @@
...
@@ -32,14 +32,28 @@
#ifndef CPPA_OPENCL_COMMAND_DISPATCHER_HPP
#ifndef CPPA_OPENCL_COMMAND_DISPATCHER_HPP
#define CPPA_OPENCL_COMMAND_DISPATCHER_HPP
#define CPPA_OPENCL_COMMAND_DISPATCHER_HPP
#include "cppa/detail/singleton_mixin.hpp"
namespace
cppa
{
namespace
opencl
{
namespace
cppa
{
namespace
opencl
{
#ifdef CPPA_OPENCL
class
command_dispatcher
{
class
command_dispatcher
{
public:
static
inline
command_dispatcher
*
create_singleton
()
{
return
new
command_dispatcher
;
}
inline
void
initialize
()
{
}
inline
void
dispose
()
{
delete
this
;
}
inline
void
destroy
()
{
delete
this
;
}
};
};
#else // CPPA_OPENCL
class
command_dispatcher
:
public
detail
::
singleton_mixin
<
command_dispatcher
>
{
}
// namespace cppa::opencl
};
#endif // CPPA_OPENCL
}
}
// namespace cppa::opencl
#endif // CPPA_OPENCL_COMMAND_DISPATCHER_HPP
#endif // CPPA_OPENCL_COMMAND_DISPATCHER_HPP
src/singleton_manager.cpp
View file @
6fb94bd4
...
@@ -49,12 +49,15 @@
...
@@ -49,12 +49,15 @@
#include "cppa/detail/thread_pool_scheduler.hpp"
#include "cppa/detail/thread_pool_scheduler.hpp"
#include "cppa/detail/uniform_type_info_map.hpp"
#include "cppa/detail/uniform_type_info_map.hpp"
#include "cppa/opencl/command_dispatcher.hpp"
namespace
cppa
{
void
shutdown
()
{
detail
::
singleton_manager
::
shutdown
();
}
}
namespace
cppa
{
void
shutdown
()
{
detail
::
singleton_manager
::
shutdown
();
}
}
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
namespace
{
namespace
{
std
::
atomic
<
opencl
::
command_dispatcher
*>
s_command_dispatcher
;
std
::
atomic
<
uniform_type_info_map
*>
s_uniform_type_info_map
;
std
::
atomic
<
uniform_type_info_map
*>
s_uniform_type_info_map
;
std
::
atomic
<
decorated_names_map
*>
s_decorated_names_map
;
std
::
atomic
<
decorated_names_map
*>
s_decorated_names_map
;
std
::
atomic
<
network
::
middleman
*>
s_middleman
;
std
::
atomic
<
network
::
middleman
*>
s_middleman
;
...
@@ -78,6 +81,7 @@ void singleton_manager::shutdown() {
...
@@ -78,6 +81,7 @@ void singleton_manager::shutdown() {
destroy
(
s_middleman
);
destroy
(
s_middleman
);
std
::
atomic_thread_fence
(
std
::
memory_order_seq_cst
);
std
::
atomic_thread_fence
(
std
::
memory_order_seq_cst
);
// it's safe to delete all other singletons now
// it's safe to delete all other singletons now
destroy
(
s_command_dispatcher
);
destroy
(
s_actor_registry
);
destroy
(
s_actor_registry
);
destroy
(
s_group_manager
);
destroy
(
s_group_manager
);
destroy
(
s_empty_tuple
);
destroy
(
s_empty_tuple
);
...
@@ -86,6 +90,10 @@ void singleton_manager::shutdown() {
...
@@ -86,6 +90,10 @@ void singleton_manager::shutdown() {
destroy
(
s_logger
);
destroy
(
s_logger
);
}
}
opencl
::
command_dispatcher
*
singleton_manager
::
get_command_dispatcher
()
{
return
lazy_get
(
s_command_dispatcher
);
}
actor_registry
*
singleton_manager
::
get_actor_registry
()
{
actor_registry
*
singleton_manager
::
get_actor_registry
()
{
return
lazy_get
(
s_actor_registry
);
return
lazy_get
(
s_actor_registry
);
}
}
...
...
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