Exemple #1
0
void iv_init(void)
{
	struct iv_state *st;

	if (iv_state_index == -1) {
		iv_state_index = TlsAlloc();
		if (iv_state_index == TLS_OUT_OF_INDEXES)
			iv_fatal("iv_init: failed to allocate TLS key");
	}

	st = calloc(1, iv_tls_total_state_size());
	TlsSetValue(iv_state_index, st);

	iv_handle_init(st);
	iv_task_init(st);
	iv_time_init(st);
	iv_timer_init(st);

	iv_tls_thread_init(st);
}
Exemple #2
0
void iv_init(void)
{
	struct iv_state *st;

	if (!iv_state_key_allocated) {
		if (pthr_key_create(&iv_state_key, iv_state_destructor))
			iv_fatal("iv_init: failed to allocate TLS key");
		iv_state_key_allocated = 1;
	}

	st = calloc(1, iv_tls_total_state_size());

	pthr_setspecific(&iv_state_key, st);

	iv_fd_init(st);
	iv_task_init(st);
	iv_timer_init(st);

	iv_event_init(st);

	iv_tls_thread_init(st);
}
Exemple #3
0
void iv_init(void)
{
	struct iv_state *st;

	if (!iv_state_key_allocated) {
		if (pthread_key_create(&iv_state_key, iv_state_destructor))
			iv_fatal("iv_init: failed to allocate TLS key");
		iv_state_key_allocated = 1;
	}

	st = calloc(1, iv_tls_total_state_size());

	pthread_setspecific(iv_state_key, st);
#ifdef HAVE_THREAD
	__st = st;
#endif

	st->numobjs = 0;

	iv_fd_init(st);
	iv_task_init(st);
	iv_timer_init(st);
	iv_tls_thread_init(st);
}