Beispiel #1
0
/* Init */
enum esif_rc esif_event_init(void)
{
	ESIF_TRACE_DYN_INIT("%s: Initialize Event\n", ESIF_FUNC);


	g_event_queue = esif_queue_create(1024, g_event_queue_name);
	if (NULL == g_event_queue)
		return ESIF_E_NO_MEMORY;

	esif_ccb_lock_init(&g_event_lock);
	return ESIF_OK;
}
Beispiel #2
0
eEsifError EsifEventMgr_Init(void)
{
	eEsifError rc = ESIF_OK;
	UInt8 i;

	ESIF_TRACE_ENTRY_INFO();

	esif_ccb_lock_init(&g_EsifEventMgr.listLock);

	for (i = 0; i < NUM_EVENT_LISTS; i++) {
		g_EsifEventMgr.observerLists[i] = esif_link_list_create();
		if (NULL == g_EsifEventMgr.observerLists[i]) {
			rc = ESIF_E_NO_MEMORY;
			goto exit;
		}
	}

	g_EsifEventMgr.eventQueuePtr = esif_queue_create(ESIF_UF_EVENT_QUEUE_SIZE, ESIF_UF_EVENT_QUEUE_NAME, ESIF_UF_EVENT_QUEUE_TIMEOUT);
	g_EsifEventMgr.garbageList = esif_link_list_create();

	if ((NULL == g_EsifEventMgr.eventQueuePtr) ||
		(NULL == g_EsifEventMgr.garbageList)) {
		rc = ESIF_E_NO_MEMORY;
		goto exit;
	}

	rc = esif_ccb_thread_create(&g_EsifEventMgr.eventQueueThread, EsifEventMgr_EventQueueThread, NULL);
	if (rc != ESIF_OK) {
		goto exit;
	}
exit:
	if (rc != ESIF_OK) {
		EsifEventMgr_Exit();
	}
	ESIF_TRACE_EXIT_INFO_W_STATUS(rc);
	return rc;
}