24 #include <fvutils/net/fuse_server.h> 25 #include <fvutils/net/fuse_server_client_thread.h> 27 #include <core/threading/thread_collector.h> 28 #include <netcomm/utils/acceptor_thread.h> 57 __thread_collector = collector;
60 if (__thread_collector) {
61 __thread_collector->
add(__acceptor_thread);
63 __acceptor_thread->
start();
71 if ( __thread_collector ) {
72 __thread_collector->
remove(__acceptor_thread);
74 __acceptor_thread->
cancel();
75 __acceptor_thread->
join();
78 for (__cit = __clients.begin(); __cit != __clients.end(); ++__cit) {
79 if ( __thread_collector ) {
81 __thread_collector->
remove(*__cit);
90 delete __acceptor_thread;
98 if ( __thread_collector) {
99 __thread_collector->
add(client);
103 __clients.push_back_locked(client);
113 __dead_clients.push_back_locked(client);
122 __dead_clients.lock();
127 while ( ! __dead_clients.empty() ) {
128 dcit = __dead_clients.begin();
130 if ( __thread_collector ) {
132 __thread_collector->
remove(*dcit);
137 if ( (__cit = find(__clients.begin(), __clients.end(), *dcit)) != __clients.end() ) {
138 __clients.erase(__cit);
142 __dead_clients.erase(dcit);
147 __dead_clients.unlock();
virtual void loop()
Code to execute in the thread.
void connection_died(FuseServerClientThread *client)
Connection died.
virtual void remove(ThreadList &tl)=0
Remove multiple threads.
Fawkes library namespace.
Thread class encapsulation of pthreads.
TCP stream socket over IP.
void wakeup()
Wake up thread.
FUSE Server Client Thread.
virtual void add(ThreadList &tl)=0
Add multiple threads.
void cancel()
Cancel a thread.
void join()
Join the thread.
virtual void add_connection(fawkes::StreamSocket *s)
Add an incoming connection.
virtual ~FuseServer()
Destructor.
void start(bool wait=true)
Call this method to start the thread.