acl/lib_fiber/cpp/include/fiber/master_fiber.hpp

49 lines
1.3 KiB
C++
Raw Normal View History

2016-06-24 10:39:05 +08:00
#pragma once
#include "acl_cpp/lib_acl.hpp"
namespace acl {
/**
*
*/
class master_fiber : public acl::master_base
{
public:
/**
* acl_master
* @param argc {int}
* @param argv {char**}
*/
void run_daemon(int argc, char** argv);
/**
*
* @param addrs {const char*}
* ip:port, ip:port, ...
* @param path {const char*} NULL
* @param count {unsigned int}
*/
bool run_alone(const char* addrs, const char* path = NULL,
unsigned int count = 0);
protected:
master_fiber();
virtual ~master_fiber();
/**
*
* @param stream {socket_stream&}
*
*/
virtual void on_accept(socket_stream& stream) = 0;
private:
static void service_main(ACL_VSTREAM*, void*);
static int service_on_accept(ACL_VSTREAM*);
2016-06-24 10:39:05 +08:00
static void service_pre_jail(void*);
static void service_init(void*);
static void service_exit(void*);
};
} // namespace acl