builtin, testmodules: Constructor and destructor first; then other methods

This commit is contained in:
Perttu Ahola 2014-09-18 01:46:16 +03:00
parent 55541903ab
commit d8a63c303d
4 changed files with 20 additions and 20 deletions

View File

@ -70,6 +70,11 @@ struct Module: public interface::Module, public network::Interface
log_v(MODULE, "network construct");
}
~Module()
{
log_v(MODULE, "network destruct");
}
void init()
{
interface::MutexScope ms(m_interface_mutex);
@ -80,11 +85,6 @@ struct Module: public interface::Module, public network::Interface
m_server->sub_event(this, Event::t("network:incoming_data"));
}
~Module()
{
log_v(MODULE, "network destruct");
}
void event(const Event::Type &type, const Event::Private *p)
{
interface::MutexScope ms(m_interface_mutex);

View File

@ -19,17 +19,17 @@ struct Module: public interface::Module
log_v(MODULE, "__loader construct");
}
~Module()
{
log_v(MODULE, "__loader destruct");
}
void init()
{
log_v(MODULE, "__loader init");
m_server->sub_event(this, Event::t("core:load_modules"));
}
~Module()
{
log_v(MODULE, "__loader destruct");
}
void event(const Event::Type &type, const Event::Private *p)
{
if(type == Event::t("core:load_modules")){

View File

@ -25,6 +25,11 @@ struct Module: public interface::Module
log_v(MODULE, "test1 construct");
}
~Module()
{
log_v(MODULE, "test1 destruct");
}
void init()
{
interface::MutexScope ms(m_interface_mutex);
@ -36,11 +41,6 @@ struct Module: public interface::Module
m_server->sub_event(this, Event::t("network:packet_received"));
}
~Module()
{
log_v(MODULE, "test1 destruct");
}
void event(const Event::Type &type, const Event::Private *p)
{
interface::MutexScope ms(m_interface_mutex);

View File

@ -23,6 +23,11 @@ struct Module: public interface::Module
log_v(MODULE, "test2 construct");
}
~Module()
{
log_v(MODULE, "test2 destruct");
}
void init()
{
interface::MutexScope ms(m_interface_mutex);
@ -31,11 +36,6 @@ struct Module: public interface::Module
m_server->sub_event(this, m_EventType_core_start);
}
~Module()
{
log_v(MODULE, "test2 destruct");
}
void event(const Event::Type &type, const Event::Private *p)
{
interface::MutexScope ms(m_interface_mutex);