I'm trying to send a log of my application when it shuts down.
So I added the following to ofApp::exit():
smtp.send(message);
smtp.waitForThread();
But the application closes before sending the mail.
When I try waiting for the thread without stopping it, the mail gets send but the application freezes and never closes:
smtp.send(message);
smtp.waitForThread(false);
I found a workaround
// in ofApp.h
bool waitForMail;
and
smtp.send(message);
waitForMail = true;
while (waitForMail)
{
// do nothing
}
and on receiving a SMTP delivery event in ofApp::onSMTPDelivery(ofx::SMTP::Message::SharedPtr& message) setting
Is this intendet behaviour? I expected either my first or second approach would have worked. I'm kind of unhappy with my current solution (a while loop with nothing in it...).
I'm trying to send a log of my application when it shuts down.
So I added the following to
ofApp::exit():But the application closes before sending the mail.
When I try waiting for the thread without stopping it, the mail gets send but the application freezes and never closes:
smtp.send(message); smtp.waitForThread(false);I found a workaround
and
and on receiving a SMTP delivery event in
ofApp::onSMTPDelivery(ofx::SMTP::Message::SharedPtr& message)settingwaitForThread = falseIs this intendet behaviour? I expected either my first or second approach would have worked. I'm kind of unhappy with my current solution (a while loop with nothing in it...).