/* setup all application wide items */ int xsldbgThreadInit(void) { int result = 0; fprintf(stderr, "mainInit()\n"); xsltSetGenericErrorFunc(0, xsldbgGenericErrorFunc); setThreadStatus(XSLDBG_MSG_THREAD_INIT); xsldbgSetAppFunc(qtNotifyXsldbgApp); xsldbgSetAppStateFunc(qtNotifyStateXsldbgApp); xsldbgSetTextFunc(qtNotifyTextXsldbgApp); xsldbgSetReadlineFunc(qtXslDbgShellReadline); /* create the thread */ if (pthread_create(&mythread, NULL, xsldbgThreadMain, NULL) != EAGAIN) { int counter; for (counter = 0; counter < 11; counter++){ if (getThreadStatus() != XSLDBG_MSG_THREAD_INIT) break; usleep(250000); /*guess that it will take at most 2.5 seconds to startup */ } /* xsldbg should have started by now if it can */ if (getThreadStatus() == XSLDBG_MSG_THREAD_RUN){ fprintf(stderr, "Created thread\n"); result++; }else fprintf(stderr, "Thread did not start\n"); } else { fprintf(stderr, "Failed to create thread\n"); } return result; }
XsldbgApp() :KApplication(false, false) { xsldbgSetAppFunc(notifyXsldbgAppSimple); xsldbgSetAppStateFunc(notifyStateXsldbgAppSimple); xsldbgSetTextFunc(notifyTextXsldbgAppSimple); xsldbgSetReadlineFunc(xslDbgShellReadlineSimple); }