[Patches] [ python-Patches-648322 ] asyncore loop_once and remove poll2

SourceForge.net noreply at sourceforge.net
Sat Jul 10 19:18:44 CEST 2004


Patches item #648322, was opened at 2002-12-04 05:55
Message generated for change (Comment added) made by akuchling
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=648322&group_id=5470

Category: Library (Lib)
Group: None
>Status: Closed
>Resolution: Accepted
Priority: 5
Submitted By: Kjetil Jacobsen (kjetilja)
Assigned to: A.M. Kuchling (akuchling)
Summary: asyncore loop_once and remove poll2

Initial Comment:
this patch does two things to asyncore.py, none of them should break any existing code which uses the module:

1) remove the (broken) poll2 function, and rather make a reference from poll2 to poll3 in the module namespace (i.e. if someone actually uses the poll2 function, poll3 will be called instead).

2) add a function loop_once which performs the asyncore loop once instead of until the socket map is empty.  asyncore.loop_once has the same function signature as asyncore.loop.





----------------------------------------------------------------------

>Comment By: A.M. Kuchling (akuchling)
Date: 2004-07-10 13:18

Message:
Logged In: YES 
user_id=11375

loop() now takes an optional 'count' parameter, so this patch can now be 
closed.  Thanks for submitting it!


----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2003-10-22 10:40

Message:
Logged In: YES 
user_id=11375

Partially checked in; the existing poll2() implementation has been removed in 
rev.1.43 in CVS.

----------------------------------------------------------------------

Comment By: A.M. Kuchling (akuchling)
Date: 2003-10-22 10:28

Message:
Logged In: YES 
user_id=11375

poll2() is written for a "poll" extension module that came with the Medusa 
distribution, so it'll never be used with a Python installation and poll2() can be 
safely removed.  

I'm less enthusiastic about loop_once().  Existing code that needs to loop once 
has been simply calling asyncore.poll(), which works fine (though perhaps 
suboptimally -- but 99% of asyncore applications won't care).  

----------------------------------------------------------------------

Comment By: Kjetil Jacobsen (kjetilja)
Date: 2002-12-05 13:46

Message:
Logged In: YES 
user_id=5685

asyncore.poll2 is broken because it does not mask the EINTR exception when invoking the poll.poll function.  this causes asyncore.poll2 to not have the same semantics as asyncore.poll and asyncore.poll3.

i don't see the point in preserving support for the poll2 function, as the poll function is now automatically a part of the select module if the system has poll support.   or am i missing something obvious here? :)

if use_poll is set and there is no poll on the system, asyncore.loop and asyncore.loop_once will fail the same way they did before.  

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-05 11:49

Message:
Logged In: YES 
user_id=21627

Can you please explain in what way poll2 is broken?

Also, what happens if use_poll is set, but there is no poll 
available on the system?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=648322&group_id=5470


More information about the Patches mailing list