void MtSync_Destruct(CMtSync *p) { if (Thread_WasCreated(&p->thread)) { MtSync_StopWriting(p); p->exit = True; if (p->needStart) Event_Set(&p->canStart); Thread_Wait(&p->thread); Thread_Close(&p->thread); } if (p->csWasInitialized) { CriticalSection_Delete(&p->cs); p->csWasInitialized = False; } Event_Close(&p->canStart); Event_Close(&p->wasStarted); Event_Close(&p->wasStopped); Semaphore_Close(&p->freeSemaphore); Semaphore_Close(&p->filledSemaphore); p->wasCreated = False; }
void LoopThread_Close(CLoopThread *p) { Thread_Close(&p->thread); Event_Close(&p->startEvent); Event_Close(&p->finishedEvent); }
static void CMtThread_CloseEvents(CMtThread *p) { Event_Close(&p->canRead); Event_Close(&p->canWrite); }