diff options
Diffstat (limited to 'src/w32xfns.c')
-rw-r--r-- | src/w32xfns.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/src/w32xfns.c b/src/w32xfns.c index 04bf5ce733e..b5b22c9aa52 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -48,6 +48,21 @@ init_crit (void) when the input queue is empty, so make it a manual reset event. */ input_available = CreateEvent (NULL, TRUE, FALSE, NULL); +#if HAVE_W32NOTIFY + /* Initialize the linked list of notifications sets that will be + used to communicate between the watching worker threads and the + main thread. */ + notifications_set_head = malloc (sizeof(struct notifications_set)); + if (notifications_set_head) + { + memset (notifications_set_head, 0, sizeof(struct notifications_set)); + notifications_set_head->next + = notifications_set_head->prev = notifications_set_head; + } + else + DebPrint(("Out of memory: can't initialize notifications sets.")); +#endif + #ifdef WINDOWSNT keyboard_handle = input_available; #endif /* WINDOWSNT */ @@ -76,6 +91,23 @@ delete_crit (void) CloseHandle (interrupt_handle); interrupt_handle = NULL; } + +#if HAVE_W32NOTIFY + if (notifications_set_head) + { + /* Free any remaining notifications set that could be left over. */ + while (notifications_set_head->next != notifications_set_head) + { + struct notifications_set *ns = notifications_set_head->next; + notifications_set_head->next = ns->next; + ns->next->prev = notifications_set_head; + if (ns->notifications) + free (ns->notifications); + free (ns); + } + } + free (notifications_set_head); +#endif } void |