[Gambas-user] Asking about a new Command

nando nando_f at ...1382...
Wed May 24 20:32:59 CEST 2006


Thanks to everyone for your replies.

This project is over a year in the making at considerable cost
and is quite involved.  It operates as a set of concurrent multiple
programs and runs on hundreds of computers.  There is use of some
specialized communication equipment.

The particular problem is I need to wait a small amount of time
for a particular hardware condition to be ready.

In my case, with Serial Port characters streaming in, if I use
the WAIT 0.5, inside the _Read, it will recurse more _Reads while
the processing of the first is incomplete.
This actually makes the stream processed out of order because
the 'newer' _Read process the next char while the original _Read
that invoked the WAIT is still unfinished.
So, processing events is forbidden in this case.

A empty loop consumes CPU...other programs are running.
WAIT allows processing of things out of order.
Although the SHELL sleep works, it is too much overhead.

This problem exists in the VB world when using DoEvents.
My solution in the VB world is to use a Boolean inside
the critical SUBs that can recurse and simply exit when busy.
That too, still uses too much CPU because there are always
characters waiting and _Read will 'event' by the interpreter
just to do a quick exit.

A Delay statement sounded like a you might have been interested in.
Essentially it would be sleeping using the kernel.

Eventhough we use fast computers, managing and minimizing CPU usage
is still an important item.

Of course, I may be ignorant and uninformed of other ways and
overlooking something easy...to which you all have been helpful.

Thanks
-Fernando

---------- Original Message -----------
From: Benoit Minisini <gambas at ...1...>
To: gambas-user at lists.sourceforge.net
Sent: Wed, 24 May 2006 18:46:53 +0200
Subject: Re: [Gambas-user] Asking about a new Command

> On Wednesday 24 May 2006 09:04, nando wrote:
> > Benoit,
> >
> > I would like to know if it is possible to add a statement like:
> >
> > DELAY      <--deliberately let the kernel use the CPU for other processes.
> > -or-
> > DELAY 0.5  <--let 1/2 second go by, processes no events and
> > not hog the CPU, deliberately let the kernel use the CPU for other
> > processes.
> >
> > It would be similar to WAIT except it would not process events.
> > It would simply keep the CPU from being tied up.
> >
> > For example:
> >
> > I need to wait a small amount of time inside a SUB, but I cannot
> > have events processed until the sub is completed.
> >
> > I have tried using WAIT in both forms, but the events get processed
> > incorrectly.
> >
> > Using a loop and looking at TIMER or TIME$ for the appropriate delay
> > only uses the CPU too much.  A DELAY would make it CPU friendlier.
> >
> > Could this be done and what amount of time
> > do you think it would take so I could calculate a donation ?
> >
> > -Fernando
> >
> 
> Why don't you want events to be processed during your wait?
> 
> -- 
> Benoit Minisini
> 
> -------------------------------------------------------
> All the advantages of Linux Managed Hosting--Without the Cost and Risk!
> Fully trained technicians. The highest number of Red Hat 
> certifications in the hosting industry. Fanatical Support. Click to 
> learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
------- End of Original Message -------





More information about the User mailing list