[En-Nut-Discussion] Locking resources but not releasing...

Harald Kipp harald.kipp at egnite.de
Tue Sep 2 10:12:34 CEST 2008


Karol Szczepanowski wrote:

> when i'm using IE and refreshing for few minutes it is working (one 
> thread is returning image other are waiting) but sometimes
> threads are waiting and it looks like the working thread died (semaphore 
> or lock are newer released)

Depends on the version you are using. The latest fix I can find in the 
ChangeLog is

* os/semaphore.c: fix bug in NutSemTryWait. It would block
if sem->value == 0 instead of returning -1.

As an alternative you can try system basics for mutual exclusion:

   #include <sys/event.h>
   static HANDLE mutex;

   /* Init */
   NutEventPost(&mutex);

   /* Request */
   NutEventWait(&mutex, timeout);

   /* Release */
   NutEventPost(&mutex);

http://www.ethernut.de/nutwiki/Events.c (German only)

In any case it'd be a good idea to use Nut/OS 4.6.3.

Harald




More information about the En-Nut-Discussion mailing list