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!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.glorb.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Niklas Holsti Newsgroups: comp.lang.ada Subject: Re: Broadcasting message to OTHER NODES Date: Fri, 10 Oct 2014 21:15:58 +0300 Organization: Tidorum Ltd Message-ID: References: <5c3b6561-8a9e-4c82-b7f9-7aba466bac12@googlegroups.com> <5633f27b-ffdd-47f3-a32b-9992d67ff135@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: individual.net vEBmN88ddBFY0ewdq2oXXQpMaTt3YOpEkHBaDXBE0IlK6HVklQ Cancel-Lock: sha1:FQRAzGqGvE7AZA8Lr1Sj2vBXkoo= User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <5633f27b-ffdd-47f3-a32b-9992d67ff135@googlegroups.com> Xref: number.nntp.giganews.com comp.lang.ada:189630 Date: 2014-10-10T21:15:58+03:00 List-Id: On 14-10-10 20:51 , Stribor40 wrote: > On Friday, 10 October 2014 13:42:58 UTC-4, Niklas Holsti wrote: >> On 14-10-10 19:23 , Stribor40 wrote: >> >>> I have 6 nodes and each of those nodes have 2 partners. So for >>> example... >> >>> task myNode is >>> entry TurnOff; >>> entry LetMeKnow; >>> end myNode; >> >>> I am trying to wrap my head around something like this ....so one >>> of those nodes can send signal to those 2 partners to turn off >>> the lights and let me know about it which is fine...The problem >>> is that now those 2 partners also have 2 partners that need to be >>> let known to turn the lights off and let me know about it. >> >>> Can someone please point me or suggest how to go about this >>> please. >> >> Please describe your goals more fully. What is the overall >> application or program that you would like to create? What are >> these "nodes"? Why do they send signals to each other? What should >> be the over-all effect of these signals? Where does the first >> signal originate? > > first signal would go from main(which is i guess 7th task). So > basically main tasks will call task1 and tell it to turn light off > and then if wait at let me know entry. If the main task (the "environment" task, in Ada terminology) immediately waits on LetMeKNow, after calling TurnOff, why not have the main task wait in TurnOff until the "turn off" action is completed? (Of course this would present all real concurrency between the tasks, but then I don't understand why this program needs concurrency at all.) > Now task1 will tell left and > right partner to turn lights off and also wait at let me know entry. > I am trying implement cascading effect like idea or propagating > original turn me on signal that started on main (who is currently > waiting at let me know entry) all the way to last node. When I say > node i meant that each node is a task itself That's a little bit clearer, but the reason for using tasks is still obscure. Also unclear is what your problem is -- what kind of help do you need? As I understand it, you have a graph of nodes -- whether it is directed or undirected is not clear -- and you want to propagate an action or signal ("turn off") that starts from one point, should reach all nodes in the graph through the "left partner" and "right parner" links between nodes, and the originator of the signal should be informed when all nodes have received the signal. You don't show how a node knows its partners. Are the nodes numbered in some way? Or are they used through access variables? For some elements of a solution, you should read about depth-first traversal of graphs -- http://en.wikipedia.org/wiki/Depth-first_search. If the nodes were records instead of tasks, the problem would be simple to solve by a recursive "traverse" procedure using depth-first search. If the signal "turn off" can arise more than once, you may have to add some kind of signal identifier -- for example, the sequential number of the signal -- to keep track of which signals a node has received, and which it hasn't. -- Niklas Holsti Tidorum Ltd niklas holsti tidorum fi . @ .