www.fallingdutch.de
News  
 
News

Services for Ultimate++

Posted by Administrator (bas) on May 11 2007 at 10:17 AM
News >>

The usage of the Service/daemon is pretty simple:

  • set the name of the service
  • implement how to react on events
  • implement the main functionality
example:

#include <Service/Service.h>

using namespace Upp;

char UPP_SERVICE_NAME[] = "Simple Service";
bool run;

SERVICE_ON_STATE_CHANGE {
    switch(state) {
        case SERVICE_START:
            LOG("let's go");
            run=true;
            break;
        case SERVICE_TERMINATE:
            run=false;
            break;
    }
}

SERVICE_APP_MAIN {
    while(run)
       Sleep(100);
}

Back

 
Top! Top!