Beispiel #1
0
static int psmx_fabric_close(fid_t fid)
{
	struct psmx_fid_fabric *fabric;

	fabric = container_of(fid, struct psmx_fid_fabric,
			      util_fabric.fabric_fid.fid);

	FI_INFO(&psmx_prov, FI_LOG_CORE, "refcnt=%d\n",
		atomic_get(&fabric->util_fabric.ref));

	psmx_fabric_release(fabric);

	if (ofi_fabric_close(&fabric->util_fabric))
		return 0;

	if (psmx_env.name_server)
		psmx_ns_stop_server(fabric);

	if (fabric->active_domain) {
		FI_WARN(&psmx_prov, FI_LOG_CORE, "forced closing of active_domain\n");
		fi_close(&fabric->active_domain->util_domain.domain_fid.fid);
	}
	assert(fabric == psmx_active_fabric);
	psmx_active_fabric = NULL;
	free(fabric);

	return 0;
}
Beispiel #2
0
static int psmx_fabric_close(fid_t fid)
{
	struct psmx_fid_fabric *fabric;
	void *exit_code;
	int ret;

	fabric = container_of(fid, struct psmx_fid_fabric,
			      util_fabric.fabric_fid.fid);

	FI_INFO(&psmx_prov, FI_LOG_CORE, "refcnt=%d\n",
		atomic_get(&fabric->util_fabric.ref));

	psmx_fabric_release(fabric);

	if (ofi_fabric_close(&fabric->util_fabric))
		return 0;

	if (psmx_env.name_server &&
	    !pthread_equal(fabric->name_server_thread, pthread_self())) {
		ret = pthread_cancel(fabric->name_server_thread);
		if (ret) {
			FI_INFO(&psmx_prov, FI_LOG_CORE,
				"pthread_cancel returns %d\n", ret);
		}
		ret = pthread_join(fabric->name_server_thread, &exit_code);
		if (ret) {
			FI_INFO(&psmx_prov, FI_LOG_CORE,
				"pthread_join returns %d\n", ret);
		} else {
			FI_INFO(&psmx_prov, FI_LOG_CORE,
				"name server thread exited with code %ld (%s)\n",
				(uintptr_t)exit_code,
				(exit_code == PTHREAD_CANCELED) ? "PTHREAD_CANCELED" : "?");
		}
	}
	if (fabric->active_domain) {
		FI_WARN(&psmx_prov, FI_LOG_CORE, "forced closing of active_domain\n");
		fi_close(&fabric->active_domain->util_domain.domain_fid.fid);
	}
	assert(fabric == psmx_active_fabric);
	psmx_active_fabric = NULL;
	free(fabric);

	return 0;
}