POLL in different OSes

Lucio Torre lucio at movilogic.com
Tue Oct 23 16:37:52 EDT 2001


>
>
>
>Create the polled objects...
>
>>>>obj1=makepolled(fd1)
>>>>obj2=makepolled(fd2)
>>>>
>
>Create the poller and add the polled...
>
>>>>poller=makepoller()
>>>>poller.addpolled(obj1)
>>>>poller.addpolled(obj2)
>>>>
>
>Enable the events I want to know about...
>
>>>>obj1.enable(PL_READ)
>>>>obj2.enable(PL_WRITE)
>>>>
>
>Poll 'em...
>
>>>>poller.poll()
>>>>
>
>Test the result...
>
>>>>if obj1.has(PL_READ):
>>>>  # Read from obj1
>>>>if obj2.has(PL_WRITE):
>>>>  # Write to obj2
>>>>
isnt iterating over every object to see if its ready or not (again) too 
expensive?

lucio





More information about the Python-list mailing list