Exemplo n.º 1
0
int
RunHelloProtocol(int argc, char **argv)
{

//	ThreadSetUniprocessorMode();

	NETDEBUG(MRSD, NETLOG_DEBUG1, ("starting hello protocol ... \n"));
	libavl_init(1);
	timerLibInit();
	// hcp_lock = LockAlloc();
	// LockInit(hcp_lock, 0);     /* Not sharing with other processes */
	
	hcpInit();


	timerInit(&hcp->Mtimer, 128, 0);
	NetFdsInit(&Hellotimerfds);

	IpcInit();

	ThreadLaunch(HelloHandleTimers, NULL, 1);

	pthread_mutex_lock(&(hellocv.mutex));
	hellocv.value = 1;
	pthread_cond_signal(&(hellocv.cond));
	pthread_mutex_unlock(&(hellocv.mutex));

	/* Main Loop */
	HelloProtMainLoop();

	return(0);
}
static pointer
PolicySetup(pointer  module,
            pointer  options,
            int     *emaj,
            int     *emin)
{
    Bool success;


    success  = ClientInit();
    success &= AuthorizeInit();
    success &= WinpropInit();
    success &= XvideoInit();
    success &= XrandrInit();
    success &= IpcInit();
    success &= ParseOptions(options);

    if (success)
        PolicyInfo("Policy extension successfuly initilized");
    else
        PolicyError("Failed to initialize policy extension");

    return module;
}
Exemplo n.º 3
0
int main(int argc, char** argv)
{
    SigInit(FurtherSignalHandling);

    if ( HandleCommandLine(argc, argv) != 0 )
        return 10;
    
    if (CsfProcInit(true, true, NULL, INI_CORECONFIG, INI_STACKCONFIG, INIDEF_CORECONFIG, INIDEF_STACKCONFIG) != 0)
        CsErrx("main: could not initialise core/stack dump on error");
        
    alarmInitialise();
    clearAlarms();

    if ( IpcInit() != 0 )
    {
        CsErrx("IpcInit() failed");
        return -1;
    }
    
    LoadIniFile();
    
    CsMutexInit(&g_rxQueueLock , CSSYNC_THREAD);
    CsMutexInit(&g_queueLock , CSSYNC_THREAD);
    CsMutexInit(&g_heartbeatMapLock , CSSYNC_THREAD);
    CsMutexInit(&g_persistLock , CSSYNC_THREAD);
    CsMutexInit(&g_LANCommunicationTimerLock, CSSYNC_THREAD);
    CsMutexInit(&g_stateLock, CSSYNC_THREAD);
    
    appQueueId     = IpcGetID(DC_TASK);
    wsQueueId      = IpcGetID(WS_TASK);
    asQueueId      = IpcGetID(AS_TASK);
    avlTaskId      = IpcGetID(MYKI_AVL_TaskId);    
    printerTaskId  = IpcGetID(DC_PRINTER_TASK); 

    if(InitialiseWebsocket()!=0)
    {
      return -1;
    }

    // Create Timer Service
    InitTimerService();
       
    getNetworkSettings();        
    
    while(initCCE()!=0)
    {
        CsErrx("Cannot connect to CCE waiting 5 seconds");
        CsSleep(5, 0);
    }   
    
    // Execute application
    ProcessMessages(NULL);

    if (IpcClose() != 0)
        CsErrx("IpcClose: failed to close");

    CsMutexDestroy(&g_rxQueueLock );
    CsMutexDestroy(&g_queueLock );
    CsMutexDestroy(&g_heartbeatMapLock );
    CsMutexDestroy(&g_LANCommunicationTimerLock );
    CsMutexDestroy(&g_persistLock );
    CsMutexDestroy(&g_stateLock );
    return 0;
}