+void do_notify_queue(void) {
+ static int doing_queue = 0;
+
+ /*
+ * This is a simple concurrency check to make sure only one queue run
+ * is done at a time. We could do this with a mutex, but since we
+ * don't really require extremely fine granularity here, we'll do it
+ * with a static variable instead.
+ */
+ if (doing_queue) return;
+ doing_queue = 1;
+
+ /*
+ * Go ahead and run the queue
+ */
+ lprintf(CTDL_INFO, "serv_funambol: processing notify queue\n");
+
+ if (getroom(&CC->room, FNBL_QUEUE_ROOM) != 0) {
+ lprintf(CTDL_ERR, "Cannot find room <%s>\n", FNBL_QUEUE_ROOM);
+ return;
+ }
+ CtdlForEachMessage(MSGS_ALL, 0L, NULL,
+ SPOOLMIME, NULL, notify_funambol, NULL);
+
+ lprintf(CTDL_INFO, "serv_funambol: queue run completed\n");
+ doing_queue = 0;
+}
+