|
cgv
|
web server interface that runs in its own thread More...
#include <web_server.h>
Public Member Functions | |
| web_server_thread (unsigned int _port=8080) | |
| create a web server that listens to the given port | |
| ~web_server_thread () | |
| calls the stop method of the web_server | |
| void | start () |
| start the web server in a separate thread | |
| void | run () |
| reimplements the run method that simply starts the web server | |
Public Member Functions inherited from cgv::os::thread | |
| thread () | |
| create the thread | |
| virtual | ~thread () |
| standard destructor (a running thread will be killed) | |
| void | start (bool _delete_after_termination=false) |
| start the implemented run() method (asynchronly) and destruct the thread object | |
| void | stop () |
| try to stop the thread execution via indicating a stop request. | |
| void | kill () |
| kill a running thread | |
| void | wait_for_completion () |
| the thread is interpreted as a slave thread and started from another master thread. | |
| bool | is_running () |
| return true if thread is running | |
| bool | have_stop_request () |
| check if there is a stop request | |
| thread_id_type | get_id () const |
| return id of this thread | |
Public Member Functions inherited from cgv::os::web_server | |
| web_server (unsigned int _port=80) | |
| create a web server that listens to the given port | |
| virtual void | handle_request (http_request &request)=0 |
| reimplement to handle requests | |
| void | start () |
| start the web server (does never return) | |
| void | stop () |
| can only be called from a different thread | |
| unsigned int | get_port () const |
| return the port to which the web server listens | |
Additional Inherited Members | |
Static Public Member Functions inherited from cgv::os::thread | |
| static void | wait_for_signal (condition_mutex &cm) |
| sleep till the signal from the given condition_mutex is sent, lock the mutex first and unlock after waiting | |
| static void | wait_for_signal_with_lock (condition_mutex &cm) |
| prefered approach to wait for signal and implemented as { cm.lock(); wait_for_signal(cm); cm.unlock(); } | |
| static bool | wait_for_signal_or_timeout (condition_mutex &cm, unsigned millisec) |
| sleep till the signal from the given condition_mutex is sent or the timeout is reached, lock the mutex first and unlock after waiting | |
| static bool | wait_for_signal_or_timeout_with_lock (condition_mutex &cm, unsigned millisec) |
| prefered approach to wait for signal or the timeout is reached and implemented as { cm.lock(); wait_for_signal_or_timeout(cm,millisec); cm.unlock(); } | |
| static void | wait (unsigned millisec) |
| wait the given number of milliseconds | |
| static thread_id_type | get_current_thread_id () |
| return the id of the currently executed thread | |
Protected Member Functions inherited from cgv::os::thread | |
| void | execute () |
| executes the run method | |
Static Protected Member Functions inherited from cgv::os::thread | |
| static void * | execute_s (void *args) |
Protected Attributes inherited from cgv::os::thread | |
| void * | thread_ptr |
| bool | stop_request |
| bool | running |
| bool | delete_after_termination |
Protected Attributes inherited from cgv::os::web_server | |
| unsigned int | port |
| void * | user_data |
web server interface that runs in its own thread
Definition at line 32 of file web_server.h.
| cgv::os::web_server_thread::web_server_thread | ( | unsigned int | _port = 8080 | ) |
create a web server that listens to the given port
Definition at line 20 of file web_server.cxx.
| cgv::os::web_server_thread::~web_server_thread | ( | ) |
calls the stop method of the web_server
Definition at line 57 of file web_server.cxx.
References cgv::os::thread::kill(), and cgv::os::web_server::stop().
|
virtual |
reimplements the run method that simply starts the web server
Implements cgv::os::thread.
Definition at line 64 of file web_server.cxx.
References cgv::os::web_server::start().
| void cgv::os::web_server_thread::start | ( | ) |
start the web server in a separate thread
start the html server in a separate thread
Definition at line 51 of file web_server.cxx.
References cgv::os::thread::start().