On 08/27/2012 09:30 AM, Frank Cox wrote: > My mailserver is small and I need to pace the email that I send to it to avoid > DOS-ing it. Therefore, I inject a pause of a fixed number of seconds between > sending each outbound email. > > If I'm not allowed to pause the program, then how shall I create the delay > between sending each message? > > Perhaps if I can get past this issue then everything else will fall into > place.
many function calls in an event driven programs don't do anything immediately. Which can be very confusing the first time you work with them. --> gtk_widget_show() will not show the widget <-- so what does it do? it registers work-to-be-done in the event loop, so once the event loop has finished working on higher priority things, it will show the widget. so that is the way you have to work with this: you register your email-to-be-sent in the main event loop, and the event loop will call the functions when it is time. Lucky for you the event loop has more options than just a priority, you can also register your function to be called after some time has passed. So create a list or queue in your program, and create a function that pops an item from the list and sends an email. register the function with a timeout with g_timeout_add_full() keep returning TRUE (= call me again) until there is no email to pop from the list. Olivier _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list