* Quits the main loop once all the events currently on the queue have
* been processed.
*
- * This function returns immediately, but will mark the ecore_main_loop_begin()
- * function to return at the end of the current main loop iteration.
+ * This function returns immediately, but if called inside the main loop
+ * it will mark the ecore_main_loop_begin() function to return at the
+ * end of the current main loop iteration.
+ *
*/
EAPI void ecore_main_loop_quit(void);
}
void
-err_completion_cb(void *data EINA_UNUSED, const char *file EINA_UNUSED, int status)
+err_completion_cb(void *data, const char *file EINA_UNUSED, int status)
{
+ if (data)
+ *((int*) data) = status;
fail_if(status != 1);
+ // NOP if called from outside main loop. Keep it here if abort fails and
+ // we get called from there.
ecore_main_loop_quit();
}
progress_cb, NULL, &job);
fail_if(res != EINA_FALSE);
+ int status = 0;
res = ecore_file_download(download_url, dest_name, err_completion_cb,
- progress_cb, NULL, &job);
+ progress_cb, &status, &job);
fail_if(res != EINA_TRUE);
fail_if(!job);
ecore_file_download_abort(job);
- ecore_main_loop_begin();
+ fail_if(status != 1);
+ if (!status)
+ ecore_main_loop_begin();
if (timeout_reached) goto end;
res = ecore_file_remove(dest_name);
fail_if(res != EINA_TRUE);