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

This commit is contained in:
rdb 2016-09-16 12:58:27 +02:00
parent 3eed7bc042
commit 7c79a999a5
3 changed files with 13 additions and 10 deletions

View File

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

View File

@ -12,7 +12,6 @@
*/
#include "multiplexStreamBuf.h"
#include "lightMutexHolder.h"
#if defined(WIN32_VC) || defined(WIN64_VC)
#define WINDOWS_LEAN_AND_MEAN
@ -114,8 +113,6 @@ void MultiplexStreamBuf::
add_output(MultiplexStreamBuf::BufferType buffer_type,
MultiplexStreamBuf::OutputType output_type,
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;
o._buffer_type = buffer_type;
@ -123,7 +120,11 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
o._out = out;
o._fout = fout;
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);
_lock.release();
}
@ -132,9 +133,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
*/
void MultiplexStreamBuf::
flush() {
LightMutexHolder holder(_lock);
_lock.acquire();
write_chars("", 0, true);
_lock.release();
}
/**
@ -143,7 +144,7 @@ flush() {
*/
int MultiplexStreamBuf::
overflow(int ch) {
LightMutexHolder holder(_lock);
_lock.acquire();
streamsize n = pptr() - pbase();
@ -158,6 +159,7 @@ overflow(int ch) {
write_chars(&c, 1, false);
}
_lock.release();
return 0;
}
@ -167,7 +169,7 @@ overflow(int ch) {
*/
int MultiplexStreamBuf::
sync() {
LightMutexHolder holder(_lock);
_lock.acquire();
streamsize n = pptr() - pbase();
@ -179,6 +181,7 @@ sync() {
write_chars(pbase(), n, false);
pbump(-n);
_lock.release();
return 0; // Return 0 for success, EOF to indicate write full.
}

View File

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