richarddamon wrote on Friday, June 28, 2019:
Sorry for the delay, this thread is very off topic and I don’t think of it as urgent. When I build an application in a FreeRTOS like environment, all of my tasks have a specific function to do, and tend to have a very specific thing to wait on to do that task, They have no need for a WaitForAny operation. Because the whole application is inside one ‘Process’, it knows about itself and knows how to talk to the right pieces.
The only cases I can see for a WaitForAny would be in a different environment where the whole system was bigger and bigger and contained multiple applications that aren’t supposed to know about how each other works and are to be isolated from each other, In this envronment, a given application may need to wait for multiple different things, and thus perhaps there is a need for a WaitForAny.
As an example, in my library of widgets I put together to build system is a task that gathers certain envronmental attributes and determines certain condtions and broadcasts this state. In a Big OS type environment, it would need some form of configuring system for the details of how it is to work, and create some from of signalling queue that others interested in its results would listen to. Under FreeRTOS it is much simpler, I add the source file for the widget to my project, that widget includes a header file that isn’t part of its library, but part of the application where I put the parameters that adjust how the widget works. When it gets a result, it calls a function that it declares but doesn’t define (or only weakly defines) with the result, and the part of the system that wants the result defines that function. If I need that result in two or more places, I define that function to just call multiple other functions to let all the places that are interested know of the result. Much simpler code, but wouldn’t be allowed in a multi-process model without a lot of overhead, as processes can’t easily get into the internals of other processes.
There is a fundamental difference in system design. A Big OS system puts at the top of the food chain, the OS, and it assumes that there are multiple users of the system wanting to use it that don’t necesarily total trust each other so it tries to provide isolate between each other.
In FreeRTOS, at the top is the systems programmer that puts together the application that will run, ONE piece of that is the FreeRTOS kernel which is one of many tools to get the job done. It is assumed that the programmer is compitent and allows him to establish efficient channels between the pieces of the application.
As I said in the beginning, I have NEVER seen the need for a WaitForAny type operation in my FreeRTOS designs, and I suspect that your desire from it comes from a multi-process mind set, and if you did get your WaitForAny, you would suddenly find the lack of those other things suddenly being the blockers. There is a LOT of overhead to support a multi-process execution model, that overhead is inappropriate for most of the systems targeted by FreeRTOS. It might be possible to provide much of what you need in a layer above/beside FreeRTOS, just like TCP or FATFS are provided.