[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] sys_timeout()
From: |
Peter Graf |
Subject: |
[lwip-users] Re: [lwip] sys_timeout() |
Date: |
Wed, 08 Jan 2003 22:20:15 -0000 |
Hi!
>while(1) {
> sys_mbox_fetch(packet);
> process_incoming_packet(packet);
>}
>
>Now, in the sys_mbox_fetch() function, the following pseudo code illustrates
>what happens:
>
>sys_mbox_fetch() {
>start:
> if(there_are_scheduled_timeouts) {
> time_until_next_timeout = calculate_time_until_next_timeout();
> if(mfetch_t(mailbox, time_until_next_timeout) == TIMEOUT) {
> call_timeout_handler_for_this_timeout();
> goto start;
> } else {
> return;
> }
> } else {
> mfetch(mailbox);
> }
>}
Thanks a lot for your explanation! It now seems clear.
My mistake was, that I saw sys_mbox_fetch() as an isolated function
which could be implemented just based on its own arguments.
(This way, the timeout implementation would have needed internal
OS infos!)
Maybe we should somewhere add a short specification about how
sys_mbox_fetch() is supposed to behave.
For example sys_mbox_fetch() and sys_sem_wait() could be given
a comment like this:
"This is an operation with a timeout. The timeout is not specified as an
argument to this function call, but as a global mechanism for this thread.
The mechanism involves all calls to sys_timeout(), sys_mbox_fetch(),
and sys_sem_wait() which are made in this thread, and uses global data.
For further info read ..."
(I think your above example explains it well. Unfortunately I had
not seen something like it, although I thought I had read your docs.)
Another way to make things easier to understand might be to pass a pointer
to the data structures used by the timeout implementation, when calling
sys_mbox_fetch() or sys_sem_wait().
Thanks a lot
Peter
[This message was sent through the lwip discussion list.]
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(),
Peter Graf <=
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Peter Graf, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Amol Deshmukh, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Peter Graf, 2003/01/08
- [lwip-users] Re: [lwip] sys_timeout(), Peter Graf, 2003/01/09
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/09
- [lwip-users] Re: [lwip] sys_timeout(), Adam Dunkels, 2003/01/09