Hi..
Thanks for the quick reply btw.
I dont know much about semaphores in general you got it rite..Im no SW
engineer, but I do know quite a lot in SMX semaphores,
and that is where my problem is. SMX semaphores are counting and binary
too, but they only count UP to a certain threshold value
which were passed upon creating the semaphores. If it equals then the
state of the semaphore becomes TRUE.
I thought lwip semaphores are the same, meaning I misinterpreted the
whole thing. Meaning signalling a lwip semaphore will count it down?
Thanks a bunch Simon. You work for Pepperl+Fuchs? You are not residing
in Mannheim arent you by any chance?
Greetings
Ikhwan
Subject: RE: [lwip-users] sys_sem_new initial conditions
Date: Wed, 28 Nov 2007 13:38:53 +0100
From: [EMAIL PROTECTED]
To: [email protected]
Hi
M.,
Sounds like
you could use an introduction about semaphores...
Semaphores in
lwIP are counting: sys_sem_wait counts the semaphore counter down by one and if
it is zero when entering sys_sem_wait, it waits until somebody else calls
sys_sem_signal (which counts up by one) so it can count
down.
The 'initial
conditions argument' passed to sys_sem_new sets the inital value of the
semaphore. E.g. when passing 0, the first call to sys_sem_wait will really wait
(unless sys_sem_signal is called first). While when passing 1, the first call
to
sys_sem_wait will succeed instantly and count the internal semaphore counter
down to 0.
But this is
really only a quick introduction, you should try to find a book to read about
that (e.g. "Modern Operating Systems" by Andrew S.
Tanenbaum).
Simon
Von:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Im
Auftrag von Muhamad Ikhwan Ismail
Gesendet: Mittwoch, 28. November
2007 13:31
An: [email protected]
Betreff: [lwip-users]
sys_sem_new initial conditions
Hi..
I am porting lwip to
SMX RTOS on PPC MPC852T from Freescale.
As I was comparing the 2 functions
for creating a semaphore for both lwip sys_arch.c and the one from smx
it
hits me... what is meant with the initial conditions argument passed to
sys_sem_new on lwip, since
smx semaphores has by default FALSE as initial
conditions and depending on the Threshold and how many times it
as been
signalled it will be set to TRUE which will be tested by the task that needs
that semaphore to be signalled.
I also noticed on some point in the code the
sys_sem_new is called and passed with value of 0 and 1.
I really
appreciate it if anyone can explain it.
Another short q, what is
sys_sem_wait for ?
Btw lwip is really a lifesaver for me, wanna say
thanks a lot the lwip developers :D
Thanks a bunch
M.
Ikhwan
_________________________________________________________________
Your smile counts. The more smiles you share, the more we donate. Join in.
www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users