Destructors should not do anything though except to free up resources that have been allocated. This includes unlocking mutexes. If pthread_mutex_unlock() returns an error ignore it.
If you really have to give a warning, ensure that giving a warning is an exception-safe action.
A destructor on a database transaction should ALWAYS rollback. It is against the nature of a destructor to commit it.
You may decide to have a wrapper class that, in one step, will commit the transaction then delete the transaction object. But that would not be a destructor.
