|
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 More... | |
| void | run () |
| reimplements the run method that simply starts the web server | |
| void | start (bool _delete_after_termination=false) |
| start the implemented run() method (asynchronly) and destruct the thread object More... | |
| void | stop () |
| void | kill () |
| kill a running thread | |
| void | wait_for_completion () |
| join the current thread More... | |
| 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 | |
| virtual void | handle_request (http_request &request)=0 |
| reimplement to handle requests | |
| void | stop () |
| can only be called from a different thread | |
| unsigned int | get_port () const |
| return the port to which the web server listens | |
Static Public Member Functions | |
| 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 More... | |
| 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 | |
| void | execute () |
| executes the run method | |
web server interface that runs in its own thread
| void cgv::os::web_server_thread::start | ( | ) |
start the web server in a separate thread
start the html server in a separate thread
|
inherited |
|
inherited |
try to stop the thread execution via indicating a stop request. The existence of a stop request can be recognized by the no_stop_request() method. This test should be done periodically within the implementation of the run() method, e.g. to leave the execution loop in a clean way.
|
inherited |
join the current thread
the thread is interpreted as a slave thread and started from another master thread. This method is called from the master thread in order to wait for termination of the slave thread.
|
staticinherited |
sleep till the signal from the given condition_mutex is sent, lock the mutex first and unlock after waiting
sleep till the signal from the given condition_mutex is sent