[En-Nut-Discussion] NutEventPost and event queues

Geir Svihus g.svihus at c2i.net
Mon Nov 24 23:04:43 CET 2003


I have been looking at NutEventPost and NutEventPostAsync. 

When implementing a semaphore you will typically init the semaphore like
this:

HANDLE *semaphore;

NutEventPost(&semaphore);

But when doing this, shouldn't we have a line like:

semaphore = NULL;

before the call to NutEventPost? If not, *qhp in NutEventPostAsync will
contain garbage and point to a NUTTHREADINFO that does not exist. 

I have seen code (ide.c and lanc111.c) that initializes some queues by use
of the last line above, but for other queues the pointer is not initialized
at all.

What is the correct way to initialize event gueues in this situation?

Regards
Geir Svihus




More information about the En-Nut-Discussion mailing list