[squeak-dev] Re: Delay time question

Jon Hylands jon at huv.com
Thu Feb 28 11:55:56 UTC 2008


On Thu, 28 Feb 2008 02:00:38 -0800, "Robert F. Scheer"
<rfscheer at speakeasy.net> wrote:

> I can do it this way, sure.  Just have to figure out how to do the
> signalling and interprocess communication.  Would you use sockets for
> the ipc?

The other thing you can try (to do this all in Squeak), which is what I
normally do, is this:

- use a higher priority process in Squeak (forkAt: Processor
userInterruptPriority) to run your serial loop

	[
		[done] whileFalse: [
			data := serialPort readBytes.
			(data notNil and: [data notEmpty])
				ifTrue: [sharedQueue nextPut: data].
			(Delay forMilliseconds: 1) wait]] forkAt: Processor
userInterruptPriority named: 'Serial-Reader'.

This way the normal processing loop just waits on a SharedQueue (basically
waiting on a semaphore), and it becomes a blocking read. You can either
feed all of your raw data into one shared queue (appropriately tagged) or
have different ones for different things.

Later,
Jon

--------------------------------------------------------------
   Jon Hylands      Jon at huv.com      http://www.huv.com/jon

  Project: Micro Raptor (Small Biped Velociraptor Robot)
           http://www.huv.com/blog



More information about the Squeak-dev mailing list