examples: fix wrong select handling

python's select does not calc remainded time.
api: change error handling

always raise OSError on C function returning error value. And not
return value if C function returns error or not.