From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: border2.nntp.dca1.giganews.com!nntp.giganews.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: STM32F4 Discovery, communication and libraries Date: Wed, 10 Sep 2014 18:16:26 +0100 Organization: A noiseless patient Spider Message-ID: References: <1cjwzr30b24xy.11kpydntxhfo5$.dlg@40tude.net> <929e9226-e4aa-474e-843c-68ed800eefad@googlegroups.com> <5b5583ca-c7b2-40be-9090-6253f0514db5@googlegroups.com> <7feccd2d-dcfd-405e-ae5d-e27d6662daa9@googlegroups.com> <80av0adfkag3khjq5pjnsihtbqmgjqpkq7@4ax.com> <80i01atqat8hrftl7lqeodf9psshlbqnk3@4ax.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: mx05.eternal-september.org; posting-host="26bd4f67a5d98ea6e6d2cb8aee4a32e6"; logging-data="28650"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18X9kuTiDRH3HTm28M8wIjThw8eUYXx1UM=" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (darwin) Cancel-Lock: sha1:+bxuf/CqyV9i+ok3w84Vzq0DvTM= sha1:bw9uL/7Svv+Lxk/71OvmhLt9LNQ= Xref: number.nntp.dca.giganews.com comp.lang.ada:188953 Date: 2014-09-10T18:16:26+01:00 List-Id: Dennis Lee Bieber writes: > "Sorting" is done by the operation to insert an event into the > queue. Inserting an entry would be done by traversing the queue from > the front, and as soon as you find an entry that has an event time > that falls after the new event being inserted you've found the > position. (Of course, if you reach the end of the queue, then the item > goes on the end ) > > Suggest a linked list with extension. That is, the top level > record has no data, only the event time and the link to the > next/previous entries. Each distinct device class would extend the > node with parameters specific to that device. > > The queue/linked-list management and dispatcher only need to see > the links and event time to control the order. The dispatcher would > have to be able to invoke the proper process based on the extended > type (I'd have to study my books for this -- "Ada for Software > Engineers, 2nd Ed" (Ben-Ari, 2009 Springer-Verlag) section 6.7 is a > linked list priority queue (intro, not fully developed), 12.2.1 > introduces call-backs. OP might be interested in my ColdFrame[1], and in particular the top page for Events[2], which is based on similar ideas. Because I'm interested in state modelling, I have four event queues; one for events-to-self, to be executed as part of one state machine action, one for state machine events, to be executed in order of posting, one for inter-domain communication, of lower priority but also to be executed in order of posting, and one for "held" events, to be executed in time order. This is probably more complicated than you need :-) [1] http://coldframe.sourceforge.net/coldframe/ [2] http://coldframe.sourceforge.net/coldframe/events.html