summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorFrancis Dupont <fdupont@isc.org>2017-10-23 00:50:40 +0200
committerFrancis Dupont <fdupont@isc.org>2017-10-23 00:50:40 +0200
commit3b4db07671c58c0e28cec44101a2e30743aa9aa5 (patch)
tree59c097ff0a300390b850eda9d4156fa2868188c8 /ext
parent[master] Added Changelog entry for #5393. (diff)
downloadkea-3b4db07671c58c0e28cec44101a2e30743aa9aa5.tar.xz
kea-3b4db07671c58c0e28cec44101a2e30743aa9aa5.zip
[5389] Addressed warnings, moved to boost coroutines
Diffstat (limited to 'ext')
-rw-r--r--ext/Makefile.am2
-rw-r--r--ext/coroutine/LICENSE_1_0.txt23
-rw-r--r--ext/coroutine/Makefile.am1
-rw-r--r--ext/coroutine/coroutine.h133
4 files changed, 1 insertions, 158 deletions
diff --git a/ext/Makefile.am b/ext/Makefile.am
index 6cfbdee32f..b2685166c6 100644
--- a/ext/Makefile.am
+++ b/ext/Makefile.am
@@ -1,4 +1,4 @@
-SUBDIRS = coroutine
+SUBDIRS = .
if HAVE_GTEST_SOURCE
SUBDIRS += gtest
diff --git a/ext/coroutine/LICENSE_1_0.txt b/ext/coroutine/LICENSE_1_0.txt
deleted file mode 100644
index 36b7cd93cd..0000000000
--- a/ext/coroutine/LICENSE_1_0.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-Boost Software License - Version 1.0 - August 17th, 2003
-
-Permission is hereby granted, free of charge, to any person or organization
-obtaining a copy of the software and accompanying documentation covered by
-this license (the "Software") to use, reproduce, display, distribute,
-execute, and transmit the Software, and to prepare derivative works of the
-Software, and to permit third-parties to whom the Software is furnished to
-do so, all subject to the following:
-
-The copyright notices in the Software and this entire statement, including
-the above license grant, this restriction and the following disclaimer,
-must be included in all copies of the Software, in whole or in part, and
-all derivative works of the Software, unless such copies or derivative
-works are solely in the form of machine-executable object code generated by
-a source language processor.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
-SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
-FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
-ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-DEALINGS IN THE SOFTWARE.
diff --git a/ext/coroutine/Makefile.am b/ext/coroutine/Makefile.am
deleted file mode 100644
index ba7b542e40..0000000000
--- a/ext/coroutine/Makefile.am
+++ /dev/null
@@ -1 +0,0 @@
-EXTRA_DIST = LICENSE_1_0.txt
diff --git a/ext/coroutine/coroutine.h b/ext/coroutine/coroutine.h
deleted file mode 100644
index 612b06b011..0000000000
--- a/ext/coroutine/coroutine.h
+++ /dev/null
@@ -1,133 +0,0 @@
-//
-// coroutine.h
-// ~~~~~~~~~~~
-//
-// Copyright (c) 2003-2010 Christopher M. Kohlhoff (chris at kohlhoff dot com)
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-//
-
-#ifndef COROUTINE_HPP
-#define COROUTINE_HPP
-
-
-// \brief Coroutine object
-//
-// A coroutine object maintains the state of a re-enterable routine. It
-// is assignable and copy-constructible, and can be used as a base class
-// for a class that uses it, or as a data member. The copy overhead is
-// a single int.
-//
-// A reentrant function contains a CORO_REENTER (coroutine) { ... }
-// block. Whenever an asynchronous operation is initiated within the
-// routine, the function is provided as the handler object. (The simplest
-// way to do this is to have the reentrant function be the operator()
-// member for the coroutine object itself.) For example:
-//
-// CORO_YIELD socket->async_read_some(buffer, *this);
-//
-// The CORO_YIELD keyword updates the current status of the coroutine to
-// indicate the line number currently being executed. The
-// async_read_some() call is initiated, with a copy of the updated
-// coroutine as its handler object, and the current coroutine exits. When
-// the async_read_some() call finishes, the copied coroutine will be
-// called, and will resume processing exactly where the original one left
-// off--right after asynchronous call. This allows asynchronous I/O
-// routines to be written with a logical flow, step following step, rather
-// than as a linked chain of separate handler functions.
-//
-// When necessary, a coroutine can fork itself using the CORO_FORK keyword.
-// This updates the status of the coroutine and makes a copy. The copy can
-// then be called directly or posted to the ASIO service queue so that both
-// coroutines will continue forward, one "parent" and one "child". The
-// is_parent() and is_child() methods indicate which is which.
-//
-// The CORO_REENTER, CORO_YIELD and CORO_FORK keywords are implemented
-// via preprocessor macros. The CORO_REENTER block is actually a large,
-// complex switch statement. Because of this, inline variable declaration
-// is impossible within CORO_REENTER unless it is done in a subsidiary
-// scope--and if it is, that scope cannot contain CORO_YIELD or CORO_FORK
-// keywords.
-//
-// Because coroutines are frequently copied, it is best to minimize copy
-// overhead by limiting the size of data members in derived classes.
-//
-// It should be noted that when a coroutine falls out of scope its memory
-// is reclaimed, even though it may be scheduled to resume when an
-// asynchronous operation completes. Any shared_ptr<> objects declared in
-// the coroutine may be destroyed if their reference count drops to zero,
-// in which case the coroutine will have serious problems once it resumes.
-// One solution so this is to have the space that will be used by a
-// coroutine pre-allocated and stored on a free list; a new coroutine can
-// fetch the block of space off a free list, place a shared pointer to it
-// on an "in use" list, and carry on. The reference in the "in use" list
-// would prevent the data from being destroyed.
-class coroutine
-{
-public:
- coroutine() : value_(0) {}
- virtual ~coroutine() {}
- bool is_child() const { return value_ < 0; }
- bool is_parent() const { return !is_child(); }
- bool is_complete() const { return value_ == -1; }
- int get_value() const { return value_; }
-private:
- friend class coroutine_ref;
- int value_;
-};
-
-class coroutine_ref
-{
-public:
- coroutine_ref(coroutine& c) : value_(c.value_), modified_(false) {}
- coroutine_ref(coroutine* c) : value_(c->value_), modified_(false) {}
- ~coroutine_ref() { if (!modified_) value_ = -1; }
- operator int() const { return value_; }
- int& operator=(int v) { modified_ = true; return value_ = v; }
-private:
- void operator=(const coroutine_ref&);
- int& value_;
- bool modified_;
-};
-
-#define CORO_REENTER(c) \
- switch (coroutine_ref _coro_value = c) \
- case -1: if (_coro_value) \
- { \
- goto terminate_coroutine; \
- terminate_coroutine: \
- _coro_value = -1; \
- goto bail_out_of_coroutine; \
- bail_out_of_coroutine: \
- break; \
- } \
- else case 0:
-
-#define CORO_YIELD \
- for (_coro_value = __LINE__;;) \
- if (_coro_value == 0) \
- { \
- case __LINE__: ; \
- break; \
- } \
- else \
- switch (_coro_value ? 0 : 1) \
- for (;;) \
- case -1: if (_coro_value) \
- goto terminate_coroutine; \
- else for (;;) \
- case 1: if (_coro_value) \
- goto bail_out_of_coroutine; \
- else case 0:
-
-#define CORO_FORK \
- for (_coro_value = -__LINE__;; _coro_value = __LINE__) \
- if (_coro_value == __LINE__) \
- { \
- case -__LINE__: ; \
- break; \
- } \
- else
-#endif // COROUTINE_HPP
-