Browse Source

Fix optimize=4 build on Windows; adjust Travis to make one opt4 build

rdb 9 years ago
parent
commit
7c79a999a5

+ 1 - 1
.travis.yml

@@ -3,7 +3,7 @@ sudo: false
 matrix:
 matrix:
   include:
   include:
     - compiler: gcc
     - compiler: gcc
-      env: PYTHONV=python2.7 FLAGS=
+      env: PYTHONV=python2.7 FLAGS=--optimize=4
     - compiler: clang
     - compiler: clang
       env: PYTHONV=python3 FLAGS=--installer
       env: PYTHONV=python3 FLAGS=--installer
     - compiler: clang
     - compiler: clang

+ 10 - 7
panda/src/downloader/multiplexStreamBuf.cxx

@@ -12,7 +12,6 @@
  */
  */
 
 
 #include "multiplexStreamBuf.h"
 #include "multiplexStreamBuf.h"
-#include "lightMutexHolder.h"
 
 
 #if defined(WIN32_VC) || defined(WIN64_VC)
 #if defined(WIN32_VC) || defined(WIN64_VC)
 #define WINDOWS_LEAN_AND_MEAN
 #define WINDOWS_LEAN_AND_MEAN
@@ -114,8 +113,6 @@ void MultiplexStreamBuf::
 add_output(MultiplexStreamBuf::BufferType buffer_type,
 add_output(MultiplexStreamBuf::BufferType buffer_type,
            MultiplexStreamBuf::OutputType output_type,
            MultiplexStreamBuf::OutputType output_type,
            ostream *out, FILE *fout, bool owns_obj) {
            ostream *out, FILE *fout, bool owns_obj) {
-  // Ensure that we have the mutex while we fiddle with the list of outputs.
-  LightMutexHolder holder(_lock);
 
 
   Output o;
   Output o;
   o._buffer_type = buffer_type;
   o._buffer_type = buffer_type;
@@ -123,7 +120,11 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
   o._out = out;
   o._out = out;
   o._fout = fout;
   o._fout = fout;
   o._owns_obj = owns_obj;
   o._owns_obj = owns_obj;
+
+  // Ensure that we have the mutex while we fiddle with the list of outputs.
+  _lock.acquire();
   _outputs.push_back(o);
   _outputs.push_back(o);
+  _lock.release();
 }
 }
 
 
 
 
@@ -132,9 +133,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
  */
  */
 void MultiplexStreamBuf::
 void MultiplexStreamBuf::
 flush() {
 flush() {
-  LightMutexHolder holder(_lock);
-
+  _lock.acquire();
   write_chars("", 0, true);
   write_chars("", 0, true);
+  _lock.release();
 }
 }
 
 
 /**
 /**
@@ -143,7 +144,7 @@ flush() {
  */
  */
 int MultiplexStreamBuf::
 int MultiplexStreamBuf::
 overflow(int ch) {
 overflow(int ch) {
-  LightMutexHolder holder(_lock);
+  _lock.acquire();
 
 
   streamsize n = pptr() - pbase();
   streamsize n = pptr() - pbase();
 
 
@@ -158,6 +159,7 @@ overflow(int ch) {
     write_chars(&c, 1, false);
     write_chars(&c, 1, false);
   }
   }
 
 
+  _lock.release();
   return 0;
   return 0;
 }
 }
 
 
@@ -167,7 +169,7 @@ overflow(int ch) {
  */
  */
 int MultiplexStreamBuf::
 int MultiplexStreamBuf::
 sync() {
 sync() {
-  LightMutexHolder holder(_lock);
+  _lock.acquire();
 
 
   streamsize n = pptr() - pbase();
   streamsize n = pptr() - pbase();
 
 
@@ -179,6 +181,7 @@ sync() {
   write_chars(pbase(), n, false);
   write_chars(pbase(), n, false);
   pbump(-n);
   pbump(-n);
 
 
+  _lock.release();
   return 0;  // Return 0 for success, EOF to indicate write full.
   return 0;  // Return 0 for success, EOF to indicate write full.
 }
 }
 
 

+ 2 - 2
panda/src/downloader/multiplexStreamBuf.h

@@ -17,7 +17,7 @@
 #include "pandabase.h"
 #include "pandabase.h"
 
 
 #include "pvector.h"
 #include "pvector.h"
-#include "lightMutex.h"
+#include "mutexImpl.h"
 #include <stdio.h>
 #include <stdio.h>
 
 
 /**
 /**
@@ -70,7 +70,7 @@ private:
   typedef pvector<Output> Outputs;
   typedef pvector<Output> Outputs;
   Outputs _outputs;
   Outputs _outputs;
 
 
-  LightMutex _lock;
+  MutexImpl _lock;
   string _line_buffer;
   string _line_buffer;
 };
 };