Python Forum
a module for multiple input waiting
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a module for multiple input waiting
#1
i think (why would i bother to do that) what would be useful is a class that takes care of multiple I/O concurrency. you just create a new instance and register your open files with it, along with optional info you want to include (pass it a tuple with the file at [0]). then you can call its wait method, giving it the time to wait (or 0 to check without waiting) and it returns the file that has something or None if there was no I/O yet to do. does that seem like a simple enough interface? could this be made to work on other platforms (by someone that knows that platform)? i know it can on Linux, BSD, and OSX. Windows i don't know (but that wouldn't stop me from making it). has it already been done? what would/should its name be?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
It looks very much like select.select() I think.
Reply
#3
the documentation fooled me, again. when i first read this, it looked like it was just another form of os.select, based on the beginning wording. that and naming it "select" convinced me that i need to move on. they should have given it a different name. if i had implemented this it probably would have used kqueue on BSD and select on Linux and Unix.

it lacks some sort of tagging feature. this would allow the caller to quickly handle the ready I/O. i don't know why it just posted my edit when i pressed the space bar, but i have seen many bugs in this editor before. the way i would have done the tagging is allow providing a sequence like a tuple where the very first item (at [0]) is the file or file descriptor and this object would be the returned object. but this is only a minor feature if a file can be used as a dictionary key (i don't know if it is hashable).

otherwise, this does look close enough to what i was going to do to not do it. maybe i'll make a wrapper unless i find something right on the mark.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  multiple mice input? (windows) madscijr 1 3,465 Jun-21-2017, 02:22 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020