initialize_bme() can throw exception, wrap thread functionality into try...catch. Also initialize_bme() creates another thread while current thread pointer is still assigned - potential race condition on joining in dtor. Maybe it is better to put both initialize* and poll cycle into thread context (including initial initialization), in this case do not throw exception but just exit polling thread if eventfd is not created for some reason