Better solution [was: Re: [BUG][Linux] VM2.8 port eats processorcycles]

Stephan Rudlof sr at evolgo.de
Sun Jul 2 17:06:44 UTC 2000


Tim Rowledge wrote:
> 
> In message <395CA347.AE870283 at evolgo.de> you wrote:
> 
> > Hmm, select() seems to be the gcd of all platforms. Probably we should
> > use this instead of nanosleep().
> Probably dumb question:- select() is in the sockets libraries, yes?

In some Linux shared lib, but not in the SocketPlugin:

The header /usr/include/sys/select.h will be included indirectly via
time.h from sq.h.

And compiling just the SocketPlugin shows no static linkage of libs:

gcc -g -fpic -O2 -I../../src -I..  -I. -I../src  -DHAVE_CONFIG_H -DUNIX
-c ../../src/SocketPlugin/SocketPlugin.c
gcc -g -fpic -O2 -I../../src -I..  -Wall -I. -I../src  -DHAVE_CONFIG_H
-DUNIX -c ../../src/SocketPlugin/sqUnixNetwork.c
gcc -fpic -shared -o ../SocketPlugin.so SocketPlugin.o sqUnixNetwork.o

So I think select() is in a *.so lib of the Linux system.

> If
> we use select(), don't we destroy the point of having all the sockets
> stuff in an external plugin?

Yes, but what is the problem here? We just use select() as platform
compatible sleep mechanism; from the man page of select():
...
NOTES
       Some  code calls select with all three sets empty, n zero,
       and a non-null timeout as a fairly portable way  to  sleep
       with subsecond precision.
...

I wanted to use nanosleep() - what principally seems to be better -, but
as we have seen it isn't available at all platforms...

> Is there no X related call to get-next-event-but-sleep-for-a-while-first
> ?

What about using a Squeak *without* X? I don't like to be dependent on X
here.

Greetings,

Stephan

> 
> tim
> 
> --
> Tim Rowledge, tim at sumeru.stanford.edu, http://sumeru.stanford.edu/tim
> Klingon Code Warrior:- 5) "Specs are for the weak and timid!"

-- 
Stephan Rudlof (sr at evolgo.de)
   "Genius doesn't work on an assembly line basis.
    You can't simply say, 'Today I will be brilliant.'"
    -- Kirk, "The Ultimate Computer", stardate 4731.3





More information about the Squeak-dev mailing list