diff options
author | Christian Grothoff <christian@grothoff.org> | 2023-06-23 11:36:43 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2023-06-23 11:36:43 +0200 |
commit | 943dcf9c5097564b34f75122699a743d283d2301 (patch) | |
tree | a221c8bacb8c0caf51fa038d32e470c3aa010dac /src | |
parent | 3b8d94fe9f82bbbfe664188e89470deec5beb7c1 (diff) | |
download | gnunet-943dcf9c5097564b34f75122699a743d283d2301.tar.gz gnunet-943dcf9c5097564b34f75122699a743d283d2301.zip |
New API is needed in case stored procedures trigger events for
our own process.
NEWS: Add new GNUNET_PQ_event_do_poll() API to gnunet_pq_lib.h
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gnunet_pq_lib.h | 13 | ||||
-rw-r--r-- | src/pq/pq_event.c | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/src/include/gnunet_pq_lib.h b/src/include/gnunet_pq_lib.h index 78eaf0d49..69cf84583 100644 --- a/src/include/gnunet_pq_lib.h +++ b/src/include/gnunet_pq_lib.h | |||
@@ -1562,6 +1562,19 @@ GNUNET_PQ_event_listen_cancel (struct GNUNET_DB_EventHandler *eh); | |||
1562 | 1562 | ||
1563 | 1563 | ||
1564 | /** | 1564 | /** |
1565 | * Poll for events right now. Useful if we may have | ||
1566 | * triggered an event for ourselves. Not needed when | ||
1567 | * using GNUNET_PQ_event_notify(), but useful when | ||
1568 | * stored procedures may have triggered events. | ||
1569 | * Does nothing if there are no events. | ||
1570 | * | ||
1571 | * @param[in,out] db database to check for events | ||
1572 | */ | ||
1573 | void | ||
1574 | GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db); | ||
1575 | |||
1576 | |||
1577 | /** | ||
1565 | * Notify all that listen on @a es of an event. | 1578 | * Notify all that listen on @a es of an event. |
1566 | * | 1579 | * |
1567 | * Unlike many other calls, this function is thread-safe and may be called | 1580 | * Unlike many other calls, this function is thread-safe and may be called |
diff --git a/src/pq/pq_event.c b/src/pq/pq_event.c index 16bd898fb..fff9e16f7 100644 --- a/src/pq/pq_event.c +++ b/src/pq/pq_event.c | |||
@@ -185,8 +185,8 @@ do_notify (void *cls, | |||
185 | } | 185 | } |
186 | 186 | ||
187 | 187 | ||
188 | static void | 188 | void |
189 | event_do_poll (struct GNUNET_PQ_Context *db) | 189 | GNUNET_PQ_event_do_poll (struct GNUNET_PQ_Context *db) |
190 | { | 190 | { |
191 | PGnotify *n; | 191 | PGnotify *n; |
192 | unsigned int cnt = 0; | 192 | unsigned int cnt = 0; |
@@ -276,7 +276,7 @@ do_scheduler_notify (void *cls) | |||
276 | db->event_task = NULL; | 276 | db->event_task = NULL; |
277 | if (NULL == db->rfd) | 277 | if (NULL == db->rfd) |
278 | GNUNET_PQ_reconnect (db); | 278 | GNUNET_PQ_reconnect (db); |
279 | event_do_poll (db); | 279 | GNUNET_PQ_event_do_poll (db); |
280 | if (NULL != db->event_task) | 280 | if (NULL != db->event_task) |
281 | return; | 281 | return; |
282 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 282 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -577,7 +577,7 @@ GNUNET_PQ_event_notify (struct GNUNET_PQ_Context *db, | |||
577 | PQerrorMessage (db->conn)); | 577 | PQerrorMessage (db->conn)); |
578 | } | 578 | } |
579 | PQclear (result); | 579 | PQclear (result); |
580 | event_do_poll (db); | 580 | GNUNET_PQ_event_do_poll (db); |
581 | } | 581 | } |
582 | 582 | ||
583 | 583 | ||