Alexandre Julliard : server: Avoid using interlocked functions.

Alexandre Julliard julliard at winehq.org
Mon May 4 15:49:16 CDT 2020


Module: wine
Branch: master
Commit: 2633a5c1ae542f08f127ba737fa59fb03ed6180b
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=2633a5c1ae542f08f127ba737fa59fb03ed6180b

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat May  2 15:10:14 2020 +0200

server: Avoid using interlocked functions.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 server/change.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/server/change.c b/server/change.c
index 6091d21f7f..a8f3329c72 100644
--- a/server/change.c
+++ b/server/change.c
@@ -88,7 +88,7 @@ struct dir
     uid_t          uid;      /* file stat.st_uid */
     struct list    entry;    /* entry in global change notifications list */
     unsigned int   filter;   /* notification filter */
-    int            notified; /* SIGIO counter */
+    volatile int   notified; /* SIGIO counter */
     int            want_data; /* return change data */
     int            subtree;  /* do we want to watch subdirectories? */
     struct list    change_records;   /* data for the change */
@@ -307,7 +307,7 @@ void do_change_notify( int unix_fd )
     LIST_FOR_EACH_ENTRY( dir, &change_list, struct dir, entry )
     {
         if (get_unix_fd( dir->fd ) != unix_fd) continue;
-        interlocked_xchg_add( &dir->notified, 1 );
+        dir->notified = 1;
         break;
     }
 }
@@ -319,8 +319,9 @@ void sigio_callback(void)
 
     LIST_FOR_EACH_ENTRY( dir, &change_list, struct dir, entry )
     {
-        if (interlocked_xchg( &dir->notified, 0 ))
-            fd_async_wake_up( dir->fd, ASYNC_TYPE_WAIT, STATUS_ALERTED );
+        if (!dir->notified) continue;
+        dir->notified = 0;
+        fd_async_wake_up( dir->fd, ASYNC_TYPE_WAIT, STATUS_ALERTED );
     }
 }
 




More information about the wine-cvs mailing list