void DeInitAccount(HACCOUNT Which) { //delete YAMN allocated fields if (Which->Name != NULL) delete[] Which->Name; if (Which->Server->Name != NULL) delete[] Which->Server->Name; if (Which->Server->Login != NULL) delete[] Which->Server->Login; if (Which->Server->Passwd != NULL) delete[] Which->Server->Passwd; if (Which->Server != NULL) delete[] Which->Server; SWMRGDelete(Which->AccountAccessSO); delete Which->AccountAccessSO; SWMRGDelete(Which->MessagesAccessSO); delete Which->MessagesAccessSO; delete Which->UsingThreads; DeleteMessagesToEndFcn(Which,(HYAMNMAIL)Which->Mails); }
BOOL WINAPI SWMRGInitialize(PSWMRG pSWMRG,TCHAR *Name) { pSWMRG->hEventNoWriter=NULL; pSWMRG->hEventNoReaders=NULL; pSWMRG->hSemNumReaders=NULL; pSWMRG->hFinishEV=NULL; // Creates the automatic-reset event that is signalled when // no writer threads are writing. // Initially no reader threads are reading. if(Name!=NULL) Name[0]=(TCHAR)'W'; pSWMRG->hEventNoWriter=CreateEvent(NULL,FALSE,TRUE,Name); // Creates the manual-reset event that is signalled when // no reader threads are reading. // Initially no reader threads are reading. if(Name!=NULL) Name[0]=(TCHAR)'R'; pSWMRG->hEventNoReaders=CreateEvent(NULL,TRUE,TRUE,Name); // Initializes the variable that indicates the number of // reader threads that are reading. // Initially no reader threads are reading. if(Name!=NULL) Name[0]=(TCHAR)'C'; pSWMRG->hSemNumReaders=CreateSemaphore(NULL,0,0x7FFFFFFF,Name); if(Name!=NULL) Name[0]=(TCHAR)'F'; pSWMRG->hFinishEV=CreateEvent(NULL,TRUE,FALSE,Name); // If a synchronization object could not be created, // destroys any created objects and return failure. if((NULL==pSWMRG->hEventNoWriter) || (NULL==pSWMRG->hEventNoReaders) || (NULL==pSWMRG->hSemNumReaders) || (NULL==pSWMRG->hFinishEV)) { SWMRGDelete(pSWMRG); return FALSE; } return TRUE; }