Revision: 7893
Author: [email protected]
Date: Thu Apr  8 07:15:40 2010
Log: Files left out of recent commit.

http://code.google.com/p/google-web-toolkit/source/detail?r=7893

Modified:
 /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp
 /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h
 /changes/jat/csproto/plugins/platform/Linux/dumpshm.cpp
 /changes/jat/csproto/plugins/platform/Linux/futextest.cpp

=======================================
--- /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp Fri Apr 2 19:51:57 2010 +++ /changes/jat/csproto/plugins/platform/Linux/ShmFutex.cpp Thu Apr 8 07:15:40 2010
@@ -82,10 +82,9 @@
 }

 // detach this memory segment, destroy futexes
-ShmFutex::~ShmFutex() {
+void ShmFutex::destroySegment() {
   clientToServer.destroy();
   serverToClient.destroy();
-  detach();
 }

 void ShmFutex::detach() {
=======================================
--- /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h Tue Apr 6 13:56:19 2010 +++ /changes/jat/csproto/plugins/platform/Linux/ShmFutex.h Thu Apr 8 07:15:40 2010
@@ -27,6 +27,7 @@
   static const int BUF_SIZE = ShmBuffer::BUF_SIZE;

// chosenKey must be at least 17chars and will be null-terminated on return.
+  // must call destroySegment
   static ShmFutex* createSegment(char* chosenKey);

   // connect to an already existing key, destructor must not be called
@@ -35,9 +36,10 @@
   // remove the identifier associated with a key
   static void removeKey(const char* key);

-  // only call this explicitly, as in p->~ShmFutex(), and only by the owner
-  // (ie, the one that called creteSegment).
-  ~ShmFutex();
+ // Only call this if the ShmFutex was returned from createSegment. This will + // destroy the data structures in the segment, but it will still need to be
+  // detached.
+  void destroySegment();

   void beginClientRead() { serverToClient.beginRead(); }
   bool beginClientRead(bool wantTimeout) {
@@ -73,6 +75,11 @@
     serverToClient.getFutexStatus(status);
   }
   void dump();
+
+protected:
+  // protect against incorrect calls, see destroySegment
+  ~ShmFutex();
+
 private:
   int magic;
   ShmBuffer clientToServer;
=======================================
--- /changes/jat/csproto/plugins/platform/Linux/dumpshm.cpp Wed Mar 31 09:29:51 2010 +++ /changes/jat/csproto/plugins/platform/Linux/dumpshm.cpp Thu Apr 8 07:15:40 2010
@@ -31,5 +31,5 @@
     exit(1);
   }
   shm->dump();
-  shm->~ShmFutex();
-}
+  shm->detach();
+}
=======================================
--- /changes/jat/csproto/plugins/platform/Linux/futextest.cpp Wed Mar 31 17:07:40 2010 +++ /changes/jat/csproto/plugins/platform/Linux/futextest.cpp Thu Apr 8 07:15:40 2010
@@ -107,7 +107,8 @@
     sprintf(cmd, "%s %s &", argv[0], key);
     system(cmd);
     runServer(shm, key);
-    shm->~ShmFutex();
+    shm->destroySegment();
+    shm->detach();
   } else {
     // client has shm key as argument
     printf("Client connecting to key %s\n", argv[1]);

--
http://groups.google.com/group/Google-Web-Toolkit-Contributors

To unsubscribe, reply using "remove me" as the subject.

Reply via email to