Ejemplo n.º 1
0
/*
 * Close the library
 */
int nvm_close_lib()
{
	int rc = NVM_SUCCESS;

	// remove any simulators that were loaded
	// don't care about any failures here because there may
	// not be a simulator loaded
	nvm_remove_simulator();

	// close the database
	if (close_lib_store() != COMMON_SUCCESS)
	{
		rc = NVM_ERR_UNKNOWN;
	}
	// clean up the locks
	if (!mutex_delete((OS_MUTEX*)&g_eventmonitor_lock, NULL))
	{
		rc = NVM_ERR_UNKNOWN;
	}
	if (!mutex_delete((OS_MUTEX*)&g_context_lock, NULL))
	{
		rc = NVM_ERR_UNKNOWN;
	}

	return rc;
}
Ejemplo n.º 2
0
Archivo: zlog.c Proyecto: rocflyhi/glow
int fini_zlog()
{
    gs_zlog.is_to_exit = TRUE;
    sema_v(gs_zlog.sema);
    thread_stop(gs_zlog.thread);
    sema_delete(gs_zlog.sema);
    mutex_delete(gs_zlog.mutex);
    if (gs_zlog.file_prefix != NULL)
        free(gs_zlog.file_prefix);
    if (gs_zlog.file != NULL)
        fclose(gs_zlog.file);
    return S_OK;
}
Ejemplo n.º 3
0
Archivo: thread.c Proyecto: bjc/nastd
int
rw_mutex_new(rw_mutex_t *lock)
{
	int rc;

	rc = mutex_new(&lock->lock);
	if (rc)
		return rc;
	rc = pthread_cond_init(&lock->read_sig, NULL);
	if (rc) {
		mutex_delete(&lock->lock);
		return rc;
	}
	rc = pthread_cond_init(&lock->write_sig, NULL);
	if (rc) {
		mutex_delete(&lock->lock);
		pthread_cond_destroy(&lock->read_sig);
		return rc;
	}
	lock->state = 0;
	lock->blocked_writers = 0;

	return 0;
}