/** * Request Reader Finalize */ int ngisiRequestReaderFinalize( ngisiContext_t *context, ngisiRequestReader_t *requestReader, int *error) { static const char fName[] = "ngisiRequestReaderFinalize"; int result; /* Check the arguments */ assert(context != NULL); assert(requestReader != NULL); result = ngislRequestReaderStopCheck(context, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Stop check failed.\n"); return 0; } result = ngisiReadBufferFinalize( context, &requestReader->ngisr_readBuffer, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Finalize the Read Buffer failed.\n"); return 0; } if (requestReader->ngisr_condInitialized != 0) { requestReader->ngisr_condInitialized = 0; result = ngisiCondFinalize( context, &requestReader->ngisr_cond, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Finalize the cond failed.\n"); return 0; } } if (requestReader->ngisr_mutexInitialized != 0) { requestReader->ngisr_mutexInitialized = 0; result = ngisiMutexFinalize( context, &requestReader->ngisr_mutex, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Finalize the mutex failed.\n"); return 0; } } ngislRequestReaderInitializeMember(requestReader); /* Success */ return 1; }
/** * RefreshCredential: Finalize. */ int ngisiRefreshCredentialFinalize( ngisiContext_t *context, ngisiRefreshCredential_t *ref, int *error) { static const char fName[] = "ngisiRefreshCredentialFinalize"; int result; /* Check the arguments */ assert(context != NULL); assert(ref != NULL); if ((ref->ngisrc_continue != 0) || (ref->ngisrc_working != 0)) { result = ngislRefreshCredentialThreadStop( context, ref, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Can't stop the Refresh Credential thread.\n"); return 0; } } if (ref->ngisrc_condInitialized != 0) { ref->ngisrc_condInitialized = 0; result = ngisiCondFinalize( context, &ref->ngisrc_cond, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Finalize the cond failed.\n"); return 0; } } if (ref->ngisrc_mutexInitialized != 0) { ref->ngisrc_mutexInitialized = 0; result = ngisiMutexFinalize( context, &ref->ngisrc_mutex, error); if (result == 0) { ngisiLogPrintf(context, NGISI_LOG_LEVEL_ERROR, fName, "Finalize the mutex failed.\n"); return 0; } } ngislRefreshCredentialInitializeMember(ref); /* Success */ return 1; }