4
* Copyright (C) 2010 Eric Day (eday@oddments.org)
7
* Use and distribution licensed under the BSD license. See the
8
* COPYING file in the root project directory for full text.
13
* @brief libevent Event Service Declarations
16
#ifndef SCALESTACK_EVENT_LIBEVENT_SERVICE_H
17
#define SCALESTACK_EVENT_LIBEVENT_SERVICE_H
21
#include <scalestack/common/macros.h>
22
#include <scalestack/event/service.h>
34
class handler_provider;
37
class SCALESTACK_API service: public event::service
42
* Add the number of threads specified in the "threads" option.
44
* @param[in] module Module that the service is associated with.
46
service(kernel::module& module);
51
* Add a handler to one of the threads in the service pool.
53
* @param[in] handler Handler to add.
54
* @param[in] handler_service_provider Handler service the handler
57
void add_handler(event::handler* handler,
58
handler_service_provider& handler_service_provider);
61
* Remove handler that was previously added in add_handler().
63
* @param[in] handler_provider Handler provider to remove.
65
void remove_handler(handler_provider* handler_provider);
70
* Don't allow copying of objects.
73
service(const service&);
76
* Don't allow assignment of objects.
79
service& operator=(const service&);
82
* Remove all threads that were created in the constructor.
84
void _remove_threads(void);
87
* See event::service::_add_handler_service().
89
event::handler_service_provider& _add_handler_service(event::handler_service& handler_service);
92
* See event::service::_remove_handler_service().
94
void _remove_handler_service(event::handler_service_provider& handler_service_provider);
96
typedef std::vector<thread*> threads;
98
size_t _current_thread;
102
} /* namespace libevent */
103
} /* namespace event */
104
} /* namespace scalestack */
106
#endif /* SCALESTACK_EVENT_LIBEVENT_SERVICE_H */