TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show HTML Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Rick Duley <[log in to unmask]>
Tue, 4 Sep 2001 01:58:44 -0400
text/plain (52 lines)
Hi teamers

I am working on a class assignment project for which I require a stream of
random characters.  To circumvent the problem of identical lists from
Ada.Discrete_Random I devised a task which continually updates seed numbers.

Because the task is CPU hungry (and my machine is one of Noah's cast-offs) I
wish to be able to turn it off and on at will, do it it instantiated by
assignment to an access type thus:

   Seeder := new Seed_Generator(Seed);

This works fine but I also need to be able to stop it and I try this

   ...
or
   accept Stop;
   exit <Working_Loop>;
or
   ...
which should IMH(if misguided)O give normal termination to the task at its
current status.  At that time I deallocate the access type in preparation
for a re-start.  However, it persists in raising CONSTRAINT_ERROR at the
call to 'Stop'.  In the meantime I have trapped this exception at the
calling point so things do work okay, but this is a dirty trick and there
must be a cleaner way.  My much-thumbed copy of the LRM remains unhelpful.

Can anyone help?
Thanks
---------------------------------------------------------

Please: if you have not already done so, alter your addressbook settings for
me to
       [log in to unmask]
---------------------------------------------------------
Rick Duley
Perth, Western Australia
tel: +61 040 910 6049                            /-_|\
                                                /     \
                                          perth *_.-._/
“Never be a pioneer.                                 v
    It's the early Christian
        that gets the fattest Lion."
            Saki (H. H. Munro (1870 - 1916))





_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

ATOM RSS1 RSS2