Author: rfm
Date: Wed Apr 15 18:14:02 2015
New Revision: 38457

URL: http://svn.gna.org/viewcvs/gnustep?rev=38457&view=rev
Log:
fixup to post notifications from the database on the main thread

Modified:
    libs/sqlclient/trunk/ChangeLog
    libs/sqlclient/trunk/Postgres.m
    libs/sqlclient/trunk/SQLClient.h

Modified: libs/sqlclient/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/ChangeLog?rev=38457&r1=38456&r2=38457&view=diff
==============================================================================
--- libs/sqlclient/trunk/ChangeLog      (original)
+++ libs/sqlclient/trunk/ChangeLog      Wed Apr 15 18:14:02 2015
@@ -1,3 +1,7 @@
+2015-04-15 Richard Frith-Macdonald  <[email protected]>
+
+       * Postgres.m: notifications are posted in main thread.
+
 2015-04-13 Richard Frith-Macdonald  <[email protected]>
 
        * SQLClient.h:

Modified: libs/sqlclient/trunk/Postgres.m
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/Postgres.m?rev=38457&r1=38456&r2=38457&view=diff
==============================================================================
--- libs/sqlclient/trunk/Postgres.m     (original)
+++ libs/sqlclient/trunk/Postgres.m     Wed Apr 15 18:14:02 2015
@@ -25,23 +25,24 @@
    $Date$ $Revision$
    */ 
 
-#import        <Foundation/NSString.h>
+#import        <Foundation/NSAutoreleasePool.h>
+#import        <Foundation/NSCalendarDate.h>
+#import        <Foundation/NSCharacterSet.h>
 #import        <Foundation/NSData.h>
 #import        <Foundation/NSDate.h>
-#import        <Foundation/NSCalendarDate.h>
-#import        <Foundation/NSCharacterSet.h>
 #import        <Foundation/NSDictionary.h>
 #import        <Foundation/NSException.h>
 #import        <Foundation/NSFileHandle.h>
-#import        <Foundation/NSProcessInfo.h>
+#import        <Foundation/NSLock.h>
+#import        <Foundation/NSMapTable.h>
 #import        <Foundation/NSNotification.h>
 #import        <Foundation/NSNotificationQueue.h>
+#import        <Foundation/NSNull.h>
+#import        <Foundation/NSProcessInfo.h>
+#import        <Foundation/NSString.h>
+#import        <Foundation/NSThread.h>
 #import        <Foundation/NSUserDefaults.h>
-#import        <Foundation/NSMapTable.h>
-#import        <Foundation/NSLock.h>
-#import        <Foundation/NSNull.h>
 #import        <Foundation/NSValue.h>
-#import        <Foundation/NSAutoreleasePool.h>
 
 #include       "config.h"
 
@@ -278,10 +279,19 @@
     }
 }
 
+- (void) _postNotification: (NSNotification*)n
+{
+  NSNotificationQueue   *nq;
+
+  /* Post asynchronously
+   */
+  nq = [NSNotificationQueue defaultQueue];
+  [nq enqueueNotification: n postingStyle: NSPostASAP];
+}
+
 - (void) _checkNotifications
 {
-  NSNotificationQueue   *nq = nil;
-  PGnotify              *notify;
+  PGnotify      *notify;
 
   while ((notify = PQnotifies(connection)) != 0)
     {
@@ -330,13 +340,9 @@
           [name release];
           [userInfo release];
 
-          if (nil == nq)
-            {
-              nq = [NSNotificationQueue defaultQueue];
-            }
-          /* Post asynchronously
-           */
-          [nq enqueueNotification: n postingStyle: NSPostASAP];
+          [self performSelectorOnMainThread: @selector(_postNotification:)
+                                 withObject: n
+                              waitUntilDone: NO];
         }
       NS_HANDLER
         {

Modified: libs/sqlclient/trunk/SQLClient.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/sqlclient/trunk/SQLClient.h?rev=38457&r1=38456&r2=38457&view=diff
==============================================================================
--- libs/sqlclient/trunk/SQLClient.h    (original)
+++ libs/sqlclient/trunk/SQLClient.h    Wed Apr 15 18:14:02 2015
@@ -1103,7 +1103,7 @@
  * There is a default implementation which does nothing ... for backends
  * which don't support asynchronous notifications.<br />
  * If a backend <em>does</em> support asynchronous notifications,
- * it should do so by posting NSNotification instances to
+ * it should do so by posting NSNotification instances to the main thread
  * [NSNotificationQueue defaultQueue] with the posting style NSPostASAP
  * (to post asynchronously) and using the SQLClient instance as
  * the notification object and supplying any payload as a string using


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to