|
From: | Jim Gibbons |
Subject: | Re: [lwip-users] critical section protection + timer issues questions |
Date: | Fri, 18 Feb 2005 11:02:35 -0800 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
I don't think that you will have any problems. In our designs, we do
not use any of the sys.c stuff for our own threads. It works fine. The only threads that need to use the sys.c stuff are those that want to have associated sys_timeout callbacks. TCP/IP is one such thread. It wants to have an associated sys_timeout to operate its tcp_tmr. Let me try to construct another example of a thread that you might have that would utilize sys_timeout calls. Let's say for example that you want to have a thread pending on a semaphore and reporting via TCP the state of a collection of A/D converters. No problems with either the underlying OS or with sys_sem. Now let's also imagine that you want the A/D converters to be sampled periodically and averaged, and that you want that averaged results to be reported in a self consistent set via TCP, upon receipt of the semaphore posting. In this instance, you could use sys_timeout within the context of the thread pending on the semaphore to govern the A/D sampling and averaging. By doing so, you could be assured that the A/D sampling and averaging was running in the same task context as your TCP reporting functions, so you wouldn't need a mutex to protect the average value storage locations. Now let me construct an example of a thread that wouldn't use the sys.c stuff at all. It's closely related to the one above, but the A/D sampling is made much simpler. Let's say that you have really fast A/D's and that you don't need to do any sampling. You just want to pend on a semaphore, and when it is posted, you want to collect data from your A/D's and report it. You don't have any need of any time related behavior, so you have no motivation to use sys_timeout. You don't need to use any sys.c stuff in such a task. I hope I've been able to make the point clearly that the sys.c services needn't be used in all tasks. You can elect to use them in some of your tasks and not in others. The key to this is making sure that the initial sys_timeout call is made in the correct task context for each of your timers, and that this subset of your tasks uses the sys_sem, sys_mbox and sys_mssleep functions. Scott Taggart wrote:
--
|
[Prev in Thread] | Current Thread | [Next in Thread] |