sample code for dealing with libev