VOID FilterThread(UT_ARGUMENT arg) { char c = (char)arg; do { EventWait(&LineEvent); if (end == 1 || strchr(line, c) != NULL) { EventSignal(&ResultEvent); } else { EventSignal(&FreeEvent); } } while (end == 0); }
VOID PrinterThread(UT_ARGUMENT outFile) { do { EventWait(&ResultEvent); if (end == 0) printf("%s", line); EventSignal(&FreeEvent); } while (end == 0); }
VOID WriterThread(UT_ARGUMENT outFile) { FILE * f = fopen((const char *)outFile, "w+"); assert(f != NULL); do { EventWait(&ResultEvent); if (end == 0) fputs(line, f); EventSignal(&FreeEvent); } while (end == 0); fclose(f); }
VOID ReaderThread(UT_ARGUMENT inFile) { FILE * f = fopen((const char *)inFile, "r"); assert(f != NULL); do { EventWait(&FreeEvent); if (fgets(line, 256, f) == NULL) end = 1; EventSignal(&LineEvent); } while (end == 0); fclose(f); }
void CATBase::GenericEventSignal(TEventSource aEventSource, TInt aStatus) // // If an IO error has occurred, complete this ATBase-object with the error. // { if (aStatus!=KErrNone) { LOGTEXT2(_L8("EventSignal received error status %d"),aStatus); CompleteWithIOError(aEventSource,aStatus); } else { EventSignal(aEventSource); } }
void CATBase::GenericEventSignal(TEventSource aEventSource, TInt aStatus) // // If an IO error has occurred, complete this ATBase-object with the error. // /** * This method is the general event signal routine. If an IO error occurred, * the Complete method is called with the errored status. If there is no * error (aStatus is KErrNone) the EventSignal routine is called. * * @param aEventSource a TEventSource member which indicates Read, Write, * or Timeout completion. * @param aStatus status from the IO operation. If this status is NOT * KErrNone, the Complete method will be called instead of the * EventSignal method. */ { if (aStatus!=KErrNone) { LOGTEXT2(_L8("CATBase EventSignal received error status %d"),aStatus); Complete(aStatus); } else EventSignal(aEventSource); }