Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Kea
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
446
Issues
446
List
Boards
Labels
Service Desk
Milestones
Merge Requests
72
Merge Requests
72
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
ISC Open Source Projects
Kea
Commits
37e3e010
Commit
37e3e010
authored
Nov 04, 2019
by
Francis Dupont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[970-implement-multi-threading-critical-section] First version
parent
46052102
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
99 additions
and
0 deletions
+99
-0
src/lib/dhcpsrv/Makefile.am
src/lib/dhcpsrv/Makefile.am
+1
-0
src/lib/dhcpsrv/multi_threading_utils.cc
src/lib/dhcpsrv/multi_threading_utils.cc
+46
-0
src/lib/dhcpsrv/multi_threading_utils.h
src/lib/dhcpsrv/multi_threading_utils.h
+52
-0
No files found.
src/lib/dhcpsrv/Makefile.am
View file @
37e3e010
...
...
@@ -117,6 +117,7 @@ libkea_dhcpsrv_la_SOURCES += lease_mgr.cc lease_mgr.h
libkea_dhcpsrv_la_SOURCES
+=
lease_mgr_factory.cc lease_mgr_factory.h
libkea_dhcpsrv_la_SOURCES
+=
memfile_lease_mgr.cc memfile_lease_mgr.h
libkea_dhcpsrv_la_SOURCES
+=
memfile_lease_storage.h
libkea_dhcpsrv_la_SOURCES
+=
multi_threading_utils.h multi_threading_utils.cc
if
HAVE_MYSQL
libkea_dhcpsrv_la_SOURCES
+=
mysql_lease_mgr.cc mysql_lease_mgr.h
...
...
src/lib/dhcpsrv/multi_threading_utils.cc
0 → 100644
View file @
37e3e010
// Copyright (C) 2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <dhcpsrv/multi_threading_utils.h>
#include <util/multi_threading_mgr.h>
#include <exceptions/exceptions.h>
using
namespace
isc
::
util
;
namespace
isc
{
namespace
dhcp
{
void
MultiThreadingCriticalSection
::
stop_pkt_processing
()
{
isc_throw
(
NotImplemented
,
"MultiThreadingCriticalSection::stop_pkt_processing "
"is not yet implemented"
);
}
void
MultiThreadingCriticalSection
::
start_pkt_processing
()
{
isc_throw
(
NotImplemented
,
"MultiThreadingCriticalSection::start_pkt_processing "
"is not yet implemented"
);
}
MultiThreadingCriticalSection
::
MultiThreadingCriticalSection
()
:
enabled_
(
MultiThreadingMgr
::
instance
().
getMode
())
{
if
(
enabled_
)
{
stop_pkt_processing
();
}
}
MultiThreadingCriticalSection
::~
MultiThreadingCriticalSection
()
{
if
(
enabled_
)
{
start_pkt_processing
();
}
}
}
}
src/lib/dhcpsrv/multi_threading_utils.h
0 → 100644
View file @
37e3e010
// Copyright (C) 2019 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef MULTI_THREADING_UTIL_H
#define MULTI_THREADING_UTIL_H
#include <boost/noncopyable.hpp>
namespace
isc
{
namespace
dhcp
{
/// @note: everything here MUST be used only from the main thread.
/// When called from a thread of the pool it can deadlock.
/// @brief Function stopping and joining all threads of the pool.
/// #throw isc::NotImplemented until is implemented.
void
stop_pkt_processing
();
/// @brief Function (re)starting threads of the pool.
/// #throw isc::NotImplemented until is implemented.
void
start_pkt_processing
();
/// @brief RAII class creating a critical section.
class
MultiThreadingCriticalSection
:
public
boost
::
noncopyable
{
public:
/// @brief Constructor.
/// Entering the critical section.
MultiThreadingCriticalSection
();
/// @brief Destructor.
/// Leaving the critical section.
virtual
~
MultiThreadingCriticalSection
();
/// @brief Class method stopping and joining all threads of the pool.
/// @throw isc::NotImplemented until is implemented.
static
void
stop_pkt_processing
();
/// @brief Class method (re)starting threads of the pool.
/// @throw isc::NotImplemented until is implemented.
static
void
start_pkt_processing
();
private:
/// @brief Local copy of the multi-threading mode.
bool
enabled_
;
};
}
}
#endif // MULTI_THREADING_UTIL_H
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