in reply to I want to forfeit my timeshare
Two cases:
- With gtk: I add the socket(s) to the pending events queue. In this case the gtk main loop takes care of giving up the CPU.
- In "straight perl" you can ask the socket to signal you (use fcntl with F_SETSIG to tell the socket what signal to send) when there is input then do a wait (which can be interrupted by a signal). The wait gives up the CPU, the signal tells the system to reschedule your process. DisclaimerActiveState does not have F_SETSIG so this won't work with that Windows port. It may or may not work with any other.
HTH, --traveler