]> icculus.org git repositories - duncan/yast2-web-wt.git/blob - src/YWebUIComponent.cc
ae7d6295e5ec4ca90b11cc8b543e3179a47ba44c
[duncan/yast2-web-wt.git] / src / YWebUIComponent.cc
1
2 #include "YWebUIComponent.h"
3 #include "YWebUI.h"
4
5 YWebUIComponent::YWebUIComponent()
6   : YUIComponent()
7 {
8
9 }
10
11 YUI * YWebUIComponent::createUI( int argc, char **argv, bool with_threads, const char * macro_file )
12 {
13   // save the arguments for the UI thread (http server args etc)
14    YWebUI::_argc = argc;
15    YWebUI::_argv = argv;
16
17    pthread_t webserver_thread;
18    pthread_attr_t attr;
19    pthread_attr_init( & attr );
20
21    if( pthread_create( & webserver_thread, & attr, start_webserver_thread, 0 ) > 0 )
22    {
23      y2internal ("Could not create Web server thread, aborting");
24      abort();
25    }
26
27    y2milestone( "Server thread running");
28
29    // wait until the UI thread is ready
30    while (! YWebUI::ui() )
31    {
32      y2milestone( "Waiting for the UI" );
33      sleep( 1 );
34    }
35      y2milestone( "UI created" );
36    return YWebUI::ui();
37 }
38
39 string YWebUIComponent::name() const { return "web"; }