[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE : Re: [lwip-users] where can i find out the function for time check
From: |
Frédéric BERNON |
Subject: |
RE : Re: [lwip-users] where can i find out the function for time check |
Date: |
Fri, 30 Mar 2007 10:09:59 +0200 |
Uhmm, not sure to understand... sys_timeout is not done to do a time check, but
to call "timers". To do that, you have to use sys.h (NO_SYS==0), you have to
call sys_timeout in the thread which will have to execute your handle, and you
have to "block" this thread with a call to sys_mbox_fetch() and sys_sem_wait().
Perhaps some pseudo code :
#define MYTIMER_TMR_INTERVAL 1000
static void
my_timer(void *arg)
{ myfunction_tmr();
sys_timeout( MYTIMER_TMR_INTERVAL, my_timer, NULL);
}
Mythread()
{ sys_sem_t sem = SYS_SEM_NULL;
/* Initialize timers */
sys_timeout( MYTIMER_TMR_INTERVAL, my_timer, NULL);
/* ... */
/* Wait for ever, but with timers handling */
sem = sys_sem_new(0);
sys_sem_wait(sem);/* never returns */
}
More, even this feature is available, to my point of view, it's not a good
thing to use it in your application (due to block your thread a a sys_sem_wait
or on a sys_mbox_fetch)...
====================================
Frédéric BERNON
HYMATOM SA
Chef de projet informatique
Microsoft Certified Professional
Tél. : +33 (0)4-67-87-61-10
Fax. : +33 (0)4-67-70-85-44
Email : address@hidden
Web Site : http://www.hymatom.fr
====================================
P Avant d'imprimer, penser à l'environnement
-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de address@hidden
Envoyé : vendredi 30 mars 2007 09:42
À : Mailing list for lwIP users
Objet : ??:Re: [lwip-users] where can i find out the function for time check
On Fri, 30 Mar 2007, 朻帡瑟 wrote:
> void
> sys_timeout(u32_t msecs, sys_timeout_handler h, void *arg)
> register a handle for timeout . but where can find the function,
> we call it for timeout check and call the timeout handle registered
> by sys_timeout().
See src/core/sys.c, inside sys_mbox_fetch() and sys_sem_wait():
.
.
h(arg);
.
.
--
Cheers,
Tai-hwa Liang
Tai-hwa Liang thanks !
Did you mean that ,lwip doesn't define time_check_function() for time check .
But we can edit sys_mbox_fetch() to our Own_Time_Check_Function(),for time
check and call timeout handle .
?家!网易3G免??,??送280兆网? www.126.com
Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE : Re: [lwip-users] where can i find out the function for time check,
Frédéric BERNON <=