Timeout question

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Timeout question

Ivan Warren
People,

I am implementing a "bare metal" (well not really, but that's not the
point) system which is :

- non-preempting multithreaded (no other thread runs before a yield() or
some waiting function)
- Single processor
- All "threads" run with interrupts disabled
- Interrupts have their own context

And

NO_SYS=1 on the lwip side.

There are multiple threads but only one (the "main" thread invokes LWIP
functions), and any "application" is using the RAW api (and is/are in
the main thread)

My questions are :

- How often should I invoke sys_check_timeouts() (every ms, every 10 ms,
every second) - or (better) is there a way to determine (after any state
change obviously) when the next timeout is due ?

- does sys_now/sys_jiffies have to be exactly milleseconds or would
powers of 2 do ? (I have a microsecond counter and a 12 right shift
would make a nice 1024 microseconds - making sys_now() sys_jiffies
return the number of "1.024" ms... would that work ?)

Thanks,

--Ivan



_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Timeout question

Sylvain Rochet
Hi Ivan,

On Tue, Nov 06, 2018 at 09:52:24AM +0100, Ivan Warren wrote:
>
> My questions are :
>
> - How often should I invoke sys_check_timeouts() (every ms, every 10 ms,
> every second) - or (better) is there a way to determine (after any state
> change obviously) when the next timeout is due ?

Is sys_timeouts_sleeptime what you are looking for ?


> - does sys_now/sys_jiffies have to be exactly milleseconds or would powers
> of 2 do ? (I have a microsecond counter and a 12 right shift would make a
> nice 1024 microseconds - making sys_now() sys_jiffies return the number of
> "1.024" ms... would that work ?)

No problem, there are not strict timers in a IP stack, after all -2.4%
is even better that some internal RC clocks. That's apply to sys_now,
concerning sys_jiffies there are no requirements at all since it can be
bound to any free running timer.


Sylvain

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Timeout question

Ivan Warren


Le 11/6/2018 à 10:08 AM, Sylvain Rochet a écrit :
> Hi Ivan,
>
>
> Is sys_timeouts_sleeptime what you are looking for ?
Exactly what I was looking for !
>
> No problem, there are not strict timers in a IP stack, after all -2.4%
> is even better that some internal RC clocks. That's apply to sys_now,
> concerning sys_jiffies there are no requirements at all since it can be
> bound to any free running timer.
>
>
Very helpful !

I guess you all figured out by now I am new to this ;) Thanks for the help !

Merci beaucoup !

--Ivan


_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

smime.p7s (5K) Download Attachment