Пример #1
0
static struct local_error *error_context()
{
	struct local_error *context = (struct local_error *)local_storage_get(&local_error_key);
	if (!context) {
		context = malloc(sizeof(struct local_error));
		assert(context);

		context->is_error = false;
		local_storage_set(&local_error_key, context);
	}
	return context;
}
Пример #2
0
FINI static void _error_fini()
{
	{
		struct local_error *context = (struct local_error *)local_storage_get(&local_error_key);
		if (context) {
			error_delete(context);
		}
	}

	error_is_valid = false;

	{
		UNUSED const bool ret = local_storage_destroy(&local_error_key);
		assert(ret);
	}
}
Пример #3
0
int thread_getid()
{
    return (ptrdiff_t)local_storage_get(&thread_id_key);
}