Browse Source

Make cpuworker_queue_work function mockable.

I'll be using this in the unit tests for consdiffmgr.
Nick Mathewson 7 years ago
parent
commit
fe584f4012
2 changed files with 6 additions and 6 deletions
  1. 4 4
      src/or/cpuworker.c
  2. 2 2
      src/or/cpuworker.h

+ 4 - 4
src/or/cpuworker.c

@@ -480,10 +480,10 @@ queue_pending_tasks(void)
 }
 
 /** DOCDOC */
-workqueue_entry_t *
-cpuworker_queue_work(workqueue_reply_t (*fn)(void *, void *),
-                     void (*reply_fn)(void *),
-                     void *arg)
+MOCK_IMPL(workqueue_entry_t *,
+cpuworker_queue_work,(workqueue_reply_t (*fn)(void *, void *),
+                      void (*reply_fn)(void *),
+                      void *arg))
 {
   tor_assert(threadpool);
 

+ 2 - 2
src/or/cpuworker.h

@@ -16,10 +16,10 @@ void cpu_init(void);
 void cpuworkers_rotate_keyinfo(void);
 struct workqueue_entry_s;
 enum workqueue_reply_t;
-struct workqueue_entry_s *cpuworker_queue_work(
+MOCK_DECL(struct workqueue_entry_s *, cpuworker_queue_work, (
                     enum workqueue_reply_t (*fn)(void *, void *),
                     void (*reply_fn)(void *),
-                    void *arg);
+                    void *arg));
 
 struct create_cell_t;
 int assign_onionskin_to_cpuworker(or_circuit_t *circ,