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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,eab7c2a03bcc6f3,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit X-Received: by 10.180.96.225 with SMTP id dv1mr1804350wib.6.1366990060226; Fri, 26 Apr 2013 08:27:40 -0700 (PDT) X-Received: by 10.180.211.194 with SMTP id ne2mr256674wic.8.1366990060195; Fri, 26 Apr 2013 08:27:40 -0700 (PDT) Path: hg5ni25646wib.1!nntp.google.com!bx2no5846778wib.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Fri, 26 Apr 2013 08:27:39 -0700 (PDT) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=189.77.226.1; posting-account=TRgI1QoAAABSsYi-ox3Pi6N-JEKKU0cu NNTP-Posting-Host: 189.77.226.1 User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Synchronization: delays x hardware timers From: "Rego, P." Injection-Date: Fri, 26 Apr 2013 15:27:40 +0000 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2013-04-26T08:27:39-07:00 List-Id: Dear friends, I would very appreciate your opinions about synchronization. I have a globa= l (static) variable which is send periodically over the communication media= and a flag is checked each cycle to get the equipment response about that = sent message. In this case, two different flags must be sent in order to ha= ve the correct response. So I have an asynchronous call to a procedure Request_Action: Global_Flag :=3D Flag_Type; -- This is sent periodically. procedure Request_Action is Initial_Response : Response_Type :=3D Get_Response; -- which is /=3D NUL= L_RESPONSE Updated_Response : Response_Type :=3D NULL_RESPONSE; -- NULL_RESPONSE is= constant =20 while Updated_Response < Initial_Response loop Global_Flag :=3D FIRST_FLAG; -- Now I should wait for the response to= be ready ; Global_Flag :=3D SECOND_FLAG; -- Now I should wait again. ; Updated_Response :=3D Get_Response; end loop; end Request_Action; The question is which is the best way to implement the . The = application is soft real-time and I just need to ensure that Global_Flag to= be processed before the next cycle begins. Also, I need to use only Ada 95= . I think that if I use a simple delay it's very enough; and since I do not h= ave a hard real-time deadline, I even do not need to use delay until. A col= eague argued with me saying that I must use hardware timers any case. Perso= nally I think it's an unnecessary use of hardware resources. I would simply code this as=20 delay CYCLE_TASK + CYCLE_DELTA; Thus, what is your opinion? Thanks very much.