Pārlūkot izejas kodu

BPending: add BSmallPending_SetHandler()

ambrop7 13 gadi atpakaļ
vecāks
revīzija
b963b8e471
2 mainītis faili ar 18 papildinājumiem un 0 dzēšanām
  1. 9 0
      base/BPending.c
  2. 9 0
      base/BPending.h

+ 9 - 0
base/BPending.c

@@ -125,6 +125,15 @@ void BSmallPending_Free (BSmallPending *o, BPendingGroup *g)
     }
 }
 
+void BSmallPending_SetHandler (BSmallPending *o, BSmallPending_handler handler, void *user)
+{
+    DebugObject_Access(&o->d_obj);
+    
+    // set handler
+    o->handler = handler;
+    o->user = user;
+}
+
 void BSmallPending_Set (BSmallPending *o, BPendingGroup *g)
 {
     DebugObject_Access(&o->d_obj);

+ 9 - 0
base/BPending.h

@@ -162,6 +162,15 @@ void BSmallPending_Init (BSmallPending *o, BPendingGroup *g, BSmallPending_handl
  */
 void BSmallPending_Free (BSmallPending *o, BPendingGroup *g);
 
+/**
+ * Changes the job execution handler.
+ * 
+ * @param o the object
+ * @param handler job execution handler
+ * @param user value to pass to handler
+ */
+void BSmallPending_SetHandler (BSmallPending *o, BSmallPending_handler handler, void *user);
+
 /**
  * Enables the job, pushing it to the top of the job list.
  * If the object was already in set state, the job is removed from its