00001 00007 00008 class CXML_StatusServer 00009 { 00010 public: 00011 static void install_XML_StatusServer(); 00012 static void* THREAD_XML_StatusServer(void*); 00013 }; 00014 00015 00016 void* CXML_StatusServer::THREAD_XML_StatusServer(void*) 00017 { 00018 ExitManager::register_cancel(); 00019 //cout << "Hello, I'm the XML Status Server, thread id = " << pthread_self() << endl; 00020 const connection_waiter my_connection_waiter(XML_status_port); 00021 while (true) 00022 { 00023 unix_io_stream tcp(my_connection_waiter.get_new_client_socket_descriptor()); // wait for client call 00024 statistical_data::XML_StatusReport(tcp); 00025 } 00026 } 00027 00028 00029 void CXML_StatusServer::install_XML_StatusServer() 00030 { 00031 static pthread_attr_t detached_thread; 00032 static pthread_t thread_process_XML; 00033 00034 pthread_attr_init(&detached_thread); 00035 pthread_attr_setdetachstate(&detached_thread, PTHREAD_CREATE_DETACHED); 00036 00037 cout << "installing XML status server..." << endl; 00038 00039 const int retcode = pthread_create(&thread_process_XML, 00040 &detached_thread,CXML_StatusServer::THREAD_XML_StatusServer, NULL); 00041 00042 if (retcode != 0) 00043 { 00044 cerr << "pthread_create failed!" << endl; 00045 exit(1); 00046 } 00047 00048 cout << "XML status server installed." << endl; 00049 }