Simpler way of defining handler functions
Missing lib deps added: rt, pthread