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=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1d4203bfa2644439,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.78.40 with SMTP id y8mr3056131paw.9.1354715634951; Wed, 05 Dec 2012 05:53:54 -0800 (PST) Path: s9ni28998pbb.0!nntp.google.com!news.glorb.com!feeder.erje.net!eu.feeder.erje.net!gandalf.srv.welterde.de!news.jacob-sparre.dk!munin.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: Jacob Sparre Andersen Newsgroups: comp.lang.ada Subject: Task with access to itself? Date: Wed, 05 Dec 2012 14:53:53 +0100 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: <8738zk7gge.fsf@adaheads.sparre-andersen.dk> NNTP-Posting-Host: monowall.adaheads.com Mime-Version: 1.0 X-Trace: munin.nbi.dk 1354715633 14182 77.234.168.91 (5 Dec 2012 13:53:53 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Wed, 5 Dec 2012 13:53:53 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:k5TWRR4DAsRaTvHnksO8iw8tg38= Content-Type: text/plain; charset=us-ascii Date: 2012-12-05T14:53:53+01:00 List-Id: I would like to maintain a collection of tasks, where the tasks themselves can register their availability. My immediate thought was to let the tasks know their own address ('Access), such that they can simply pass that to the collection of available tasks, when they are ready. But I haven't found a nice way to implement that pattern, so may be I should do it a different way. type Handler is type Reference is access all Handler; task type Handler is entry Set (Self : in Reference); entry Do_Stuff (...); end Handler; task body Handler is Pointer : Reference; begin accept Set (Self : in Reference) do Pointer := Self; end Set; loop accept Do_Stuff (...) do ... end Do_Stuff; ... Register_As_Available (Pointer); end loop; end Handler; Any suggestions? Jacob -- ... but, following long-established custom, it is Laplace's result that is always called, in the modern litterature, "Bayes' theorem." (Jaynes)