gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r21028 - in gnunet/src: dns gns hostlist include transport


From: gnunet
Subject: [GNUnet-SVN] r21028 - in gnunet/src: dns gns hostlist include transport util
Date: Thu, 19 Apr 2012 14:07:05 +0200

Author: grothoff
Date: 2012-04-19 14:07:05 +0200 (Thu, 19 Apr 2012)
New Revision: 21028

Modified:
   gnunet/src/dns/gnunet-service-dns.c
   gnunet/src/gns/gnunet-gns-fcfsd.c
   gnunet/src/hostlist/hostlist-client.c
   gnunet/src/hostlist/hostlist-server.c
   gnunet/src/include/gnunet_scheduler_lib.h
   gnunet/src/transport/gnunet-service-transport_blacklist.c
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/plugin_transport_http_client.c
   gnunet/src/transport/plugin_transport_http_server.c
   gnunet/src/transport/plugin_transport_udp.c
   gnunet/src/transport/plugin_transport_unix.c
   gnunet/src/util/scheduler.c
   gnunet/src/util/server.c
   gnunet/src/util/test_scheduler.c
Log:
-fixing #2274 -- eliminating GNUNET_SCHEDULER_add_after

Modified: gnunet/src/dns/gnunet-service-dns.c
===================================================================
--- gnunet/src/dns/gnunet-service-dns.c 2012-04-19 11:55:40 UTC (rev 21027)
+++ gnunet/src/dns/gnunet-service-dns.c 2012-04-19 12:07:05 UTC (rev 21028)
@@ -734,7 +734,6 @@
   if (NULL != rs->dnsout6)
     GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
   rs->read_task = GNUNET_SCHEDULER_add_select 
(GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                              GNUNET_SCHEDULER_NO_TASK,
                                               REQUEST_TIMEOUT,
                                               rset,
                                               NULL,
@@ -1100,7 +1099,6 @@
   if (NULL != rs->dnsout6)
     GNUNET_NETWORK_fdset_set (rset, rs->dnsout6);
   rs->read_task = GNUNET_SCHEDULER_add_select 
(GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                              GNUNET_SCHEDULER_NO_TASK,
                                               
GNUNET_TIME_absolute_get_remaining (rs->timeout),
                                               rset,
                                               NULL,

Modified: gnunet/src/gns/gnunet-gns-fcfsd.c
===================================================================
--- gnunet/src/gns/gnunet-gns-fcfsd.c   2012-04-19 11:55:40 UTC (rev 21027)
+++ gnunet/src/gns/gnunet-gns-fcfsd.c   2012-04-19 12:07:05 UTC (rev 21028)
@@ -642,7 +642,7 @@
   GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
   httpd_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                   tv, wrs, wws,
                                    &do_httpd, NULL);
   GNUNET_NETWORK_fdset_destroy (wrs);
   GNUNET_NETWORK_fdset_destroy (wws);

Modified: gnunet/src/hostlist/hostlist-client.c
===================================================================
--- gnunet/src/hostlist/hostlist-client.c       2012-04-19 11:55:40 UTC (rev 
21027)
+++ gnunet/src/hostlist/hostlist-client.c       2012-04-19 12:07:05 UTC (rev 
21028)
@@ -766,7 +766,7 @@
 #endif
   ti_download =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, rtime, grs, gws,
+                                   rtime, grs, gws,
                                    &task_download, multi);
   GNUNET_NETWORK_fdset_destroy (gws);
   GNUNET_NETWORK_fdset_destroy (grs);

Modified: gnunet/src/hostlist/hostlist-server.c
===================================================================
--- gnunet/src/hostlist/hostlist-server.c       2012-04-19 11:55:40 UTC (rev 
21027)
+++ gnunet/src/hostlist/hostlist-server.c       2012-04-19 12:07:05 UTC (rev 
21028)
@@ -512,7 +512,7 @@
   GNUNET_NETWORK_fdset_copy_native (wes, &es, max + 1);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                  tv, wrs, wws,
                                    &run_daemon, daemon_handle);
   GNUNET_NETWORK_fdset_destroy (wrs);
   GNUNET_NETWORK_fdset_destroy (wws);

Modified: gnunet/src/include/gnunet_scheduler_lib.h
===================================================================
--- gnunet/src/include/gnunet_scheduler_lib.h   2012-04-19 11:55:40 UTC (rev 
21027)
+++ gnunet/src/include/gnunet_scheduler_lib.h   2012-04-19 12:07:05 UTC (rev 
21028)
@@ -309,26 +309,6 @@
 
 
 /**
- * Schedule a new task to be run after the specified prerequisite task
- * has completed. It will be run with DEFAULT priority.
- *
- * * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use  GNUNET_SCHEDULER_NO_TASK to not have any 
dependency
- *        on completion of other tasks (this will cause the task to run as
- *        soon as possible).
- * @param task main function of the task
- * @param task_cls closure of task
- * @return unique task identifier for the job
- *         only valid until "task" is started!
- */
-GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
-                            GNUNET_SCHEDULER_Task task, void *task_cls);
-
-
-/**
  * Schedule a new task to be run with a specified priority.
  *
  * * @param prio how important is the new task?
@@ -511,12 +491,7 @@
  *     || shutdown-active)
  * </code>
  *
- * * @param prio how important is this task?
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use GNUNET_SCHEDULER_NO_TASK to not have any 
dependency
- *        on completion of other tasks.
+ * @param prio how important is this task?
  * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for 
"forever",
  *        which means that the task will only be run after we receive SIGTERM
  * @param rs set of file descriptors we want to read (can be NULL)
@@ -527,8 +502,7 @@
  *         only valid until "task" is started!
  */
 GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
-                             GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
+GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,              
              
                              struct GNUNET_TIME_Relative delay,
                              const struct GNUNET_NETWORK_FDSet *rs,
                              const struct GNUNET_NETWORK_FDSet *ws,

Modified: gnunet/src/transport/gnunet-service-transport_blacklist.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_blacklist.c   2012-04-19 
11:55:40 UTC (rev 21027)
+++ gnunet/src/transport/gnunet-service-transport_blacklist.c   2012-04-19 
12:07:05 UTC (rev 21028)
@@ -113,7 +113,7 @@
    * Current transmission request handle for this client, or NULL if no
    * request is pending.
    */
-  struct GNUNET_CONNECTION_TransmitHandle *th;
+  struct GNUNET_SERVER_TransmitHandle *th;
 
   /**
    * Our current position in the blacklisters list.
@@ -191,7 +191,7 @@
       bc->bl_pos = bl->next;
       if (bc->th != NULL)
       {
-        GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th);
+        GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
         bc->th = NULL;
       }
       if (bc->task == GNUNET_SCHEDULER_NO_TASK)
@@ -813,7 +813,7 @@
   }
   if (NULL != bc->th)
   {
-    GNUNET_CONNECTION_notify_transmit_ready_cancel (bc->th);
+    GNUNET_SERVER_notify_transmit_ready_cancel (bc->th);
     bc->th = NULL;
   }
   GNUNET_free (bc);

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2012-04-19 
11:55:40 UTC (rev 21027)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2012-04-19 
12:07:05 UTC (rev 21028)
@@ -102,7 +102,7 @@
   /**
    * Current transmit request handle.
    */
-  struct GNUNET_CONNECTION_TransmitHandle *th;
+  struct GNUNET_SERVER_TransmitHandle *th;
 
   /**
    * Length of the list of messages pending for this client.
@@ -417,7 +417,7 @@
   GNUNET_CONTAINER_DLL_remove (clients_head, clients_tail, tc);
   if (tc->th != NULL)
   {
-    GNUNET_CONNECTION_notify_transmit_ready_cancel (tc->th);
+    GNUNET_SERVER_notify_transmit_ready_cancel (tc->th);
     tc->th = NULL;
   }
   GNUNET_break (0 == tc->message_count);

Modified: gnunet/src/transport/plugin_transport_http_client.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_client.c 2012-04-19 11:55:40 UTC 
(rev 21027)
+++ gnunet/src/transport/plugin_transport_http_client.c 2012-04-19 12:07:05 UTC 
(rev 21028)
@@ -133,7 +133,7 @@
 
   plugin->client_perform_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, timeout, grs, gws,
+                                   timeout, grs, gws,
                                    &client_run, plugin);
   GNUNET_NETWORK_fdset_destroy (gws);
   GNUNET_NETWORK_fdset_destroy (grs);

Modified: gnunet/src/transport/plugin_transport_http_server.c
===================================================================
--- gnunet/src/transport/plugin_transport_http_server.c 2012-04-19 11:55:40 UTC 
(rev 21027)
+++ gnunet/src/transport/plugin_transport_http_server.c 2012-04-19 12:07:05 UTC 
(rev 21028)
@@ -988,7 +988,7 @@
 #endif
     ret =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                     tv, wrs, wws,
                                      &server_v4_run, plugin);
   }
   if (daemon_handle == plugin->server_v6)
@@ -1004,7 +1004,7 @@
 #endif
     ret =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK, tv, wrs, wws,
+                                     tv, wrs, wws,
                                      &server_v6_run, plugin);
   }
   GNUNET_NETWORK_fdset_destroy (wrs);

Modified: gnunet/src/transport/plugin_transport_udp.c
===================================================================
--- gnunet/src/transport/plugin_transport_udp.c 2012-04-19 11:55:40 UTC (rev 
21027)
+++ gnunet/src/transport/plugin_transport_udp.c 2012-04-19 12:07:05 UTC (rev 
21028)
@@ -936,7 +936,6 @@
 
       plugin->select_task =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v4,
                                        plugin->ws_v4,
@@ -954,7 +953,6 @@
 
       plugin->select_task_v6 =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v6,
                                        plugin->ws_v6,
@@ -1096,7 +1094,6 @@
 
       plugin->select_task =
           GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                       GNUNET_SCHEDULER_NO_TASK,
                                        GNUNET_TIME_UNIT_FOREVER_REL,
                                        plugin->rs_v4,
                                        plugin->ws_v4,
@@ -1114,7 +1111,6 @@
 
       plugin->select_task_v6 =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs_v6,
                                      plugin->ws_v6,
@@ -1847,7 +1843,6 @@
   if (plugin->select_task != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (plugin->select_task);
   plugin->select_task = GNUNET_SCHEDULER_add_select 
(GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v4,
                                    (plugin->ipv4_queue_head != NULL) ? 
plugin->ws_v4 : NULL,
@@ -1895,7 +1890,6 @@
   if (plugin->select_task_v6 != GNUNET_SCHEDULER_NO_TASK)
     GNUNET_SCHEDULER_cancel (plugin->select_task_v6);
   plugin->select_task_v6 = GNUNET_SCHEDULER_add_select 
(GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v6,
                                    (plugin->ipv6_queue_head != NULL) ? 
plugin->ws_v6 : NULL,
@@ -2034,7 +2028,6 @@
 
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs_v4,
                                    NULL,
@@ -2055,7 +2048,6 @@
 
     plugin->select_task_v6 =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs_v6,
                                      NULL,

Modified: gnunet/src/transport/plugin_transport_unix.c
===================================================================
--- gnunet/src/transport/plugin_transport_unix.c        2012-04-19 11:55:40 UTC 
(rev 21027)
+++ gnunet/src/transport/plugin_transport_unix.c        2012-04-19 12:07:05 UTC 
(rev 21028)
@@ -644,7 +644,6 @@
 
     plugin->select_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL,
                                      plugin->rs,
                                      plugin->ws,
@@ -835,7 +834,6 @@
     GNUNET_SCHEDULER_cancel (plugin->select_task);
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs,
                                    (plugin->msg_head != NULL) ? plugin->ws : 
NULL,
@@ -906,7 +904,6 @@
 
   plugin->select_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL,
                                    plugin->rs,
                                    NULL,

Modified: gnunet/src/util/scheduler.c
===================================================================
--- gnunet/src/util/scheduler.c 2012-04-19 11:55:40 UTC (rev 21027)
+++ gnunet/src/util/scheduler.c 2012-04-19 12:07:05 UTC (rev 21028)
@@ -1107,31 +1107,6 @@
 
 
 /**
- * Schedule a new task to be run after the specified prerequisite task
- * has completed. It will be run with the DEFAULT priority.
- *
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use  GNUNET_SCHEDULER_NO_TASK to not have any 
dependency
- *        on completion of other tasks (this will cause the task to run as
- *        soon as possible).
- * @param task main function of the task
- * @param task_cls closure of task
- * @return unique task identifier for the job
- *         only valid until "task" is started!
- */
-GNUNET_SCHEDULER_TaskIdentifier
-GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
-                            GNUNET_SCHEDULER_Task task, void *task_cls)
-{
-  return GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                      prerequisite_task, GNUNET_TIME_UNIT_ZERO,
-                                      NULL, NULL, task, task_cls);
-}
-
-
-/**
  * Schedule a new task to be run with a specified priority.
  *
  * @param prio how important is the new task?
@@ -1144,7 +1119,7 @@
 GNUNET_SCHEDULER_add_with_priority (enum GNUNET_SCHEDULER_Priority prio,
                                     GNUNET_SCHEDULER_Task task, void *task_cls)
 {
-  return GNUNET_SCHEDULER_add_select (prio, GNUNET_SCHEDULER_NO_TASK,
+  return GNUNET_SCHEDULER_add_select (prio, 
                                       GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
                                       task_cls);
 }
@@ -1299,7 +1274,6 @@
 
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_ZERO, NULL, NULL, task,
                                    task_cls);
   GNUNET_assert (pending->id == ret);
@@ -1450,7 +1424,7 @@
   GNUNET_NETWORK_fdset_set (rs, rfd);
   ret =
     GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL,
+                                delay, rs, NULL,
                                 task, task_cls);
   GNUNET_NETWORK_fdset_destroy (rs);
   return ret;
@@ -1493,7 +1467,7 @@
   GNUNET_NETWORK_fdset_set (ws, wfd);
   ret =
     GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws,
+                                delay, NULL, ws,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (ws);
   return ret;
@@ -1536,7 +1510,7 @@
   GNUNET_NETWORK_fdset_handle_set (rs, rfd);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, delay, rs, NULL,
+                                   delay, rs, NULL,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (rs);
   return ret;
@@ -1581,7 +1555,7 @@
   GNUNET_NETWORK_fdset_handle_set (ws, wfd);
   ret =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT,
-                                   GNUNET_SCHEDULER_NO_TASK, delay, NULL, ws,
+                                   delay, NULL, ws,
                                    task, task_cls);
   GNUNET_NETWORK_fdset_destroy (ws);
   return ret;
@@ -1617,11 +1591,6 @@
  * </code>
  *
  * @param prio how important is this task?
- * @param prerequisite_task run this task after the task with the given
- *        task identifier completes (and any of our other
- *        conditions, such as delay, read or write-readiness
- *        are satisfied).  Use GNUNET_SCHEDULER_NO_TASK to not have any 
dependency
- *        on completion of other tasks.
  * @param delay how long should we wait? Use GNUNET_TIME_UNIT_FOREVER_REL for 
"forever",
  *        which means that the task will only be run after we receive SIGTERM
  * @param rs set of file descriptors we want to read (can be NULL)
@@ -1633,7 +1602,6 @@
  */
 GNUNET_SCHEDULER_TaskIdentifier
 GNUNET_SCHEDULER_add_select (enum GNUNET_SCHEDULER_Priority prio,
-                             GNUNET_SCHEDULER_TaskIdentifier prerequisite_task,
                              struct GNUNET_TIME_Relative delay,
                              const struct GNUNET_NETWORK_FDSet *rs,
                              const struct GNUNET_NETWORK_FDSet *ws,
@@ -1671,7 +1639,6 @@
 #if PROFILE_DELAYS
   t->start_time = GNUNET_TIME_absolute_get ();
 #endif
-  t->prereq_id = prerequisite_task;
   t->timeout = GNUNET_TIME_relative_to_absolute (delay);
   t->priority =
       check_priority ((prio ==

Modified: gnunet/src/util/server.c
===================================================================
--- gnunet/src/util/server.c    2012-04-19 11:55:40 UTC (rev 21027)
+++ gnunet/src/util/server.c    2012-04-19 12:07:05 UTC (rev 21028)
@@ -324,7 +324,6 @@
     /* ignore shutdown, someone else will take care of it! */
     server->listen_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                      &process_listen_socket, server);
     GNUNET_NETWORK_fdset_destroy (r);
@@ -354,7 +353,6 @@
   /* listen for more! */
   server->listen_task =
       GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                   GNUNET_SCHEDULER_NO_TASK,
                                    GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                    &process_listen_socket, server);
   GNUNET_NETWORK_fdset_destroy (r);
@@ -498,7 +496,6 @@
       GNUNET_NETWORK_fdset_set (r, ret->listen_sockets[i++]);
     ret->listen_task =
         GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_HIGH,
-                                     GNUNET_SCHEDULER_NO_TASK,
                                      GNUNET_TIME_UNIT_FOREVER_REL, r, NULL,
                                      &process_listen_socket, ret);
     GNUNET_NETWORK_fdset_destroy (r);

Modified: gnunet/src/util/test_scheduler.c
===================================================================
--- gnunet/src/util/test_scheduler.c    2012-04-19 11:55:40 UTC (rev 21027)
+++ gnunet/src/util/test_scheduler.c    2012-04-19 12:07:05 UTC (rev 21028)
@@ -30,37 +30,25 @@
 #define VERBOSE GNUNET_NO
 
 static void
-task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  /* t4 should be ready (albeit with lower priority) */
+  /* t3 should be ready (albeit with lower priority) */
   GNUNET_assert (1 ==
                  GNUNET_SCHEDULER_get_load (GNUNET_SCHEDULER_PRIORITY_COUNT));
-  GNUNET_assert (3 == *ok);
-  (*ok) = 4;
-}
-
-
-static void
-task2 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
-{
-  int *ok = cls;
-
   GNUNET_assert (2 == *ok);
   (*ok) = 3;
-  /* t3 will go before t4: higher priority */
-  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task3,
-                                      cls);
 }
 
+
 static void
-task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task3 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  GNUNET_assert (4 == *ok);
-  (*ok) = 5;
+  GNUNET_assert (3 == *ok);
+  (*ok) = 4;
 }
 
 struct GNUNET_DISK_PipeHandle *p;
@@ -113,11 +101,11 @@
 
 
 static void
-task5 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
+task4 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
 
-  GNUNET_assert (5 == *ok);
+  GNUNET_assert (4 == *ok);
   (*ok) = 6;
   p = GNUNET_DISK_pipe (GNUNET_NO, GNUNET_NO, GNUNET_NO, GNUNET_NO);
   GNUNET_assert (NULL != p);
@@ -134,17 +122,13 @@
 task1 (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
 {
   int *ok = cls;
-  GNUNET_SCHEDULER_TaskIdentifier t2;
-  GNUNET_SCHEDULER_TaskIdentifier t4;
 
   GNUNET_assert (1 == *ok);
   (*ok) = 2;
-  /* t2 will go first -- prereq for all */
-  t2 = GNUNET_SCHEDULER_add_after (GNUNET_SCHEDULER_NO_TASK, &task2, cls);
-  /* t4 will go after t2 ('add after') and after t3 (priority) */
-  t4 = GNUNET_SCHEDULER_add_after (t2, &task4, cls);
-  /* t5 will go last (after p4) */
-  GNUNET_SCHEDULER_add_after (t4, &task5, cls);
+  GNUNET_SCHEDULER_add_now (&task3, cls);
+  GNUNET_SCHEDULER_add_with_priority (GNUNET_SCHEDULER_PRIORITY_UI, &task2,
+                                      cls);
+  GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_SECONDS, &task4, cls);
 }
 
 
@@ -225,8 +209,8 @@
 
   GNUNET_assert (1 == *ok);
   *ok = 0;
-  GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_after
-                           (GNUNET_SCHEDULER_NO_TASK, &taskNeverRun, NULL));
+  GNUNET_SCHEDULER_cancel (GNUNET_SCHEDULER_add_now
+                           (&taskNeverRun, NULL));
 }
 
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]