mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
ircd: Remove ircd::strand related.
This commit is contained in:
parent
da5d767431
commit
e2edd13a33
3 changed files with 2 additions and 39 deletions
|
@ -30,19 +30,6 @@
|
||||||
#include <boost/asio/spawn.hpp>
|
#include <boost/asio/spawn.hpp>
|
||||||
#include <boost/asio/io_service.hpp>
|
#include <boost/asio/io_service.hpp>
|
||||||
|
|
||||||
struct ircd::strand
|
|
||||||
:asio::io_service::strand
|
|
||||||
{
|
|
||||||
using handler = std::function<void ()>;
|
|
||||||
|
|
||||||
operator const asio::io_service &() const;
|
|
||||||
operator asio::io_service &();
|
|
||||||
|
|
||||||
strand(asio::io_service &ios)
|
|
||||||
:asio::io_service::strand{ios}
|
|
||||||
{}
|
|
||||||
};
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// The following IRCd headers are not included in the main stdinc.h list of
|
/// The following IRCd headers are not included in the main stdinc.h list of
|
||||||
/// includes because they require boost directly or symbols which we cannot
|
/// includes because they require boost directly or symbols which we cannot
|
||||||
|
@ -52,16 +39,3 @@ struct ircd::strand
|
||||||
|
|
||||||
#include <ircd/ctx/continuation.h>
|
#include <ircd/ctx/continuation.h>
|
||||||
#include <ircd/net/asio.h>
|
#include <ircd/net/asio.h>
|
||||||
|
|
||||||
inline ircd::strand::operator
|
|
||||||
asio::io_service &()
|
|
||||||
{
|
|
||||||
return get_io_service();
|
|
||||||
}
|
|
||||||
|
|
||||||
inline ircd::strand::operator
|
|
||||||
const asio::io_service &()
|
|
||||||
const
|
|
||||||
{
|
|
||||||
return const_cast<strand *>(this)->get_io_service();
|
|
||||||
}
|
|
||||||
|
|
|
@ -35,9 +35,6 @@ namespace ircd
|
||||||
/// The user's io_service
|
/// The user's io_service
|
||||||
extern asio::io_context *ios;
|
extern asio::io_context *ios;
|
||||||
|
|
||||||
/// IRCd's strand of the io_service
|
|
||||||
struct strand extern *strand;
|
|
||||||
|
|
||||||
bool is_main_thread();
|
bool is_main_thread();
|
||||||
void assert_main_thread();
|
void assert_main_thread();
|
||||||
|
|
||||||
|
|
12
ircd/ircd.cc
12
ircd/ircd.cc
|
@ -8,9 +8,6 @@
|
||||||
// copyright notice and this permission notice is present in all copies. The
|
// copyright notice and this permission notice is present in all copies. The
|
||||||
// full license for this software is available in the LICENSE file.
|
// full license for this software is available in the LICENSE file.
|
||||||
|
|
||||||
#include <ircd/asio.h>
|
|
||||||
#include <ircd/m/m.h>
|
|
||||||
|
|
||||||
namespace ircd
|
namespace ircd
|
||||||
{
|
{
|
||||||
enum runlevel _runlevel {runlevel::HALT}; // Current libircd runlevel
|
enum runlevel _runlevel {runlevel::HALT}; // Current libircd runlevel
|
||||||
|
@ -23,7 +20,6 @@ namespace ircd
|
||||||
bool nojs; // no ircd::js system init.
|
bool nojs; // no ircd::js system init.
|
||||||
|
|
||||||
boost::asio::io_context *ios; // user's io service
|
boost::asio::io_context *ios; // user's io service
|
||||||
struct strand *strand; // libircd event serializer
|
|
||||||
ctx::ctx *main_context; // Main program loop
|
ctx::ctx *main_context; // Main program loop
|
||||||
|
|
||||||
void set_runlevel(const enum runlevel &);
|
void set_runlevel(const enum runlevel &);
|
||||||
|
@ -76,10 +72,8 @@ try
|
||||||
// ios.run() is really running.
|
// ios.run() is really running.
|
||||||
ircd::thread_id = std::this_thread::get_id();
|
ircd::thread_id = std::this_thread::get_id();
|
||||||
|
|
||||||
// Global ircd:: reference to the user's io_context and setup our main
|
// Global ircd:: reference to the user's io_context
|
||||||
// strand on that service.
|
|
||||||
ircd::ios = &ios;
|
ircd::ios = &ios;
|
||||||
ircd::strand = new struct strand(ios);
|
|
||||||
|
|
||||||
// The log is available. but it is console-only until conf opens files.
|
// The log is available. but it is console-only until conf opens files.
|
||||||
log::init();
|
log::init();
|
||||||
|
@ -122,8 +116,6 @@ try
|
||||||
}
|
}
|
||||||
catch(const std::exception &e)
|
catch(const std::exception &e)
|
||||||
{
|
{
|
||||||
delete strand;
|
|
||||||
strand = nullptr;
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -309,7 +301,7 @@ try
|
||||||
// CONTINUATION ON THIS STACK by the user.
|
// CONTINUATION ON THIS STACK by the user.
|
||||||
if(!ircd::runlevel_changed::list.empty())
|
if(!ircd::runlevel_changed::list.empty())
|
||||||
{
|
{
|
||||||
ios->post([new_runlevel]
|
ircd::post([new_runlevel]
|
||||||
{
|
{
|
||||||
if(new_runlevel == runlevel::HALT)
|
if(new_runlevel == runlevel::HALT)
|
||||||
log::notice
|
log::notice
|
||||||
|
|
Loading…
Reference in a new issue