Update of /cvsroot/pypgsql/pypgsql/examples
In directory usw-pr-cvs1:/tmp/cvs-serv15077
Modified Files:
demo2a.py
Log Message:
20SEP2001 gh Changed demo2a to use select.select instead of select.poll.
This is to make the example work on platforms that don't
support the poll function.
Index: demo2a.py
===================================================================
RCS file: /cvsroot/pypgsql/pypgsql/examples/demo2a.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** demo2a.py 2001/08/24 22:26:00 1.2
--- demo2a.py 2001/09/20 04:19:38 1.3
***************
*** 49,61 ****
# to res, the previous result is cleaned up automagically.
! pobj = select.poll()
! pobj.register(cnx.socket, select.POLLIN)
sys.stdout.write('Waiting.')
while 1:
! # Wait a little (using poll())
sys.stdout.flush()
! pres = pobj.poll(1000)
! if len(pres) == 0:
sys.stdout.write('.')
else:
--- 49,62 ----
# to res, the previous result is cleaned up automagically.
! # To make this also work on Windows, we use select.select() instead of the much
! # nicer select.poll()
!
sys.stdout.write('Waiting.')
while 1:
! # Wait a little (using select())
sys.stdout.flush()
! ready_sockets = select.select([cnx.socket], [], [], 1.0)[0]
! if len(ready_sockets) == 0:
sys.stdout.write('.')
else:
|