Changeset: 97051bd58261 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/97051bd58261
Modified Files:
        gdk/gdk.h
        gdk/gdk_bbp.c
Branch: strheapvacuum
Log Message:

initilal callback interface


diffs (63 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -2384,4 +2384,24 @@ gdk_export BAT *BATsample_with_seed(BAT 
                        CALLBACK;               \
        } while (0)
 
+typedef struct gdk_callback {
+       char *name;
+       int argc;
+       int delay;  // units sec or ms??
+       lng last_called; // timestamp GDKusec
+       gdk_return (*func)(int argc, void *argv[]);
+       gdk_return (*argsfree)(int argc, void *argv[]);
+       struct gdk_callback *next;
+       void *argv[];
+} gdk_callback;
+
+typedef struct gdk_callback_list {
+       int cnt;
+       MT_Lock lock;
+       gdk_callback *head;
+} gdk_callback_list;
+
+int gdk_add_callback(gdk_callback *);
+int gdk_remove_callback(char *);
+
 #endif /* _GDK_H_ */
diff --git a/gdk/gdk_bbp.c b/gdk/gdk_bbp.c
--- a/gdk/gdk_bbp.c
+++ b/gdk/gdk_bbp.c
@@ -4126,3 +4126,31 @@ gdk_bbp_reset(void)
        backup_dir = 0;
        backup_subdir = 0;
 }
+
+static gdk_callback_list callback_list = {
+       .cnt = 0,
+       .head = NULL,
+       .lock=MT_LOCK_INITIALIZER(GDKCallbackListLock),
+};
+
+/*
+ * @- Add a callback
+ * Adds new callback to the callback list.
+ * Returns the count of the callbacks in the callback_list.
+ */
+int gdk_add_callback(gdk_callback *callback) {
+       // TODO
+       (void) callback;
+       return callback_list.cnt;
+}
+
+/*
+ * @- Remove a callback
+ * Removes a callback from the callback list with a given name as an argument.
+ * Returns the count of the callbacks in the callback_list.
+ */
+int gdk_remove_callback(char *cb_name) {
+       // TODO
+       (void) cb_name;
+       return callback_list.cnt;
+}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to