Merge branch 'master' into cmake
This commit is contained in:
commit
d0ebc59d32
|
|
@ -24,6 +24,8 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
|
|||
_velocity = LVecBase3(0.0, 0.0, 0.0);
|
||||
_steering_force = LVecBase3(0.0, 0.0, 0.0);
|
||||
|
||||
_world = nullptr;
|
||||
|
||||
_steering = new AIBehaviors();
|
||||
_steering->_ai_char = this;
|
||||
|
||||
|
|
@ -31,6 +33,7 @@ AICharacter::AICharacter(string model_name, NodePath model_np, double mass, doub
|
|||
}
|
||||
|
||||
AICharacter::~AICharacter() {
|
||||
nassertv(_world == nullptr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@
|
|||
#define _AICHARACTER_H
|
||||
|
||||
#include "aiBehaviors.h"
|
||||
#include "referenceCount.h"
|
||||
|
||||
/**
|
||||
* This class is used for creating the AI characters. It assigns both physics
|
||||
|
|
@ -25,7 +26,7 @@
|
|||
class AIBehaviors;
|
||||
class AIWorld;
|
||||
|
||||
class EXPCL_PANDAAI AICharacter {
|
||||
class EXPCL_PANDAAI AICharacter : public ReferenceCount {
|
||||
public:
|
||||
double _mass;
|
||||
double _max_force;
|
||||
|
|
|
|||
|
|
@ -14,44 +14,56 @@
|
|||
#include "aiWorld.h"
|
||||
|
||||
AIWorld::AIWorld(NodePath render) {
|
||||
_ai_char_pool = new AICharPool();
|
||||
_render = render;
|
||||
_render = move(render);
|
||||
}
|
||||
|
||||
AIWorld::~AIWorld() {
|
||||
}
|
||||
|
||||
void AIWorld::add_ai_char(AICharacter *ai_char) {
|
||||
_ai_char_pool->append(ai_char);
|
||||
_ai_char_pool.push_back(ai_char);
|
||||
ai_char->_window_render = _render;
|
||||
ai_char->_world = this;
|
||||
}
|
||||
|
||||
void AIWorld::remove_ai_char(string name) {
|
||||
_ai_char_pool->del(name);
|
||||
remove_ai_char_from_flock(name);
|
||||
AICharPool::iterator it;
|
||||
for (it = _ai_char_pool.begin(); it != _ai_char_pool.end(); ++it) {
|
||||
AICharacter *ai_char = *it;
|
||||
if (ai_char->_name == name) {
|
||||
nassertv(ai_char->_world == this);
|
||||
ai_char->_world = nullptr;
|
||||
_ai_char_pool.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
remove_ai_char_from_flock(move(name));
|
||||
}
|
||||
|
||||
void AIWorld::remove_ai_char_from_flock(string name) {
|
||||
AICharPool::node *ai_pool;
|
||||
ai_pool = _ai_char_pool->_head;
|
||||
while((ai_pool) != NULL) {
|
||||
for(unsigned int i = 0; i < _flock_pool.size(); ++i) {
|
||||
if(ai_pool->_ai_char->_ai_char_flock_id == _flock_pool[i]->get_id()) {
|
||||
for(unsigned int j = 0; j<_flock_pool[i]->_ai_char_list.size(); ++j) {
|
||||
if(_flock_pool[i]->_ai_char_list[j]->_name == name) {
|
||||
_flock_pool[i]->_ai_char_list.erase(_flock_pool[i]->_ai_char_list.begin() + j);
|
||||
for (AICharacter *ai_char : _ai_char_pool) {
|
||||
for (Flock *flock : _flock_pool) {
|
||||
if (ai_char->_ai_char_flock_id == flock->get_id()) {
|
||||
for (size_t j = 0; j < flock->_ai_char_list.size(); ++j) {
|
||||
if (flock->_ai_char_list[j]->_name == name) {
|
||||
flock->_ai_char_list.erase(flock->_ai_char_list.begin() + j);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ai_pool = ai_pool->_next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function prints the names of the AI characters that have been added to
|
||||
* the AIWorld. Useful for debugging purposes.
|
||||
*/
|
||||
void AIWorld::print_list() {
|
||||
_ai_char_pool->print_list();
|
||||
for (AICharacter *ai_char : _ai_char_pool) {
|
||||
cout << ai_char->_name << endl;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -59,12 +71,8 @@ void AIWorld::print_list() {
|
|||
* characters which have been added to the AIWorld.
|
||||
*/
|
||||
void AIWorld::update() {
|
||||
AICharPool::node *ai_pool;
|
||||
ai_pool = _ai_char_pool->_head;
|
||||
|
||||
while((ai_pool)!=NULL) {
|
||||
ai_pool->_ai_char->update();
|
||||
ai_pool = ai_pool->_next;
|
||||
for (AICharacter *ai_char : _ai_char_pool) {
|
||||
ai_char->update();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -142,86 +150,6 @@ void AIWorld::flock_on(unsigned int flock_id) {
|
|||
}
|
||||
}
|
||||
|
||||
AICharPool::AICharPool() {
|
||||
_head = NULL;
|
||||
}
|
||||
|
||||
AICharPool::~AICharPool() {
|
||||
}
|
||||
|
||||
void AICharPool::append(AICharacter *ai_ch) {
|
||||
node *q;
|
||||
node *t;
|
||||
|
||||
if(_head == NULL) {
|
||||
q = new node();
|
||||
q->_ai_char = ai_ch;
|
||||
q->_next = NULL;
|
||||
_head = q;
|
||||
}
|
||||
else {
|
||||
q = _head;
|
||||
while( q->_next != NULL) {
|
||||
q = q->_next;
|
||||
}
|
||||
|
||||
t = new node();
|
||||
t->_ai_char = ai_ch;
|
||||
t->_next = NULL;
|
||||
q->_next = t;
|
||||
}
|
||||
}
|
||||
|
||||
void AICharPool::del(string name) {
|
||||
node *q;
|
||||
node *r;
|
||||
q = _head;
|
||||
|
||||
if(_head==NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Only one node in the linked list
|
||||
if(q->_next == NULL) {
|
||||
if(q->_ai_char->_name == name) {
|
||||
_head = NULL;
|
||||
delete q;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
r = q;
|
||||
while( q != NULL) {
|
||||
if( q->_ai_char->_name == name) {
|
||||
// Special case
|
||||
if(q == _head) {
|
||||
_head = q->_next;
|
||||
delete q;
|
||||
return;
|
||||
}
|
||||
|
||||
r->_next = q->_next;
|
||||
delete q;
|
||||
return;
|
||||
}
|
||||
r = q;
|
||||
q = q->_next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function prints the ai characters in the AICharPool. Used for
|
||||
* debugging purposes.
|
||||
*/
|
||||
void AICharPool::print_list() {
|
||||
node* q;
|
||||
q = _head;
|
||||
while(q != NULL) {
|
||||
cout<<q->_ai_char->_name<<endl;
|
||||
q = q->_next;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds the nodepath as an obstacle that is needed by the
|
||||
* obstacle avoidance behavior.
|
||||
|
|
|
|||
|
|
@ -21,27 +21,6 @@
|
|||
class AICharacter;
|
||||
class Flock;
|
||||
|
||||
/**
|
||||
* This class implements a linked list of AI Characters allowing the user to
|
||||
* add and delete characters from the linked list. This will be used in the
|
||||
* AIWorld class.
|
||||
*/
|
||||
class EXPCL_PANDAAI AICharPool {
|
||||
public:
|
||||
struct node {
|
||||
AICharacter * _ai_char;
|
||||
node * _next;
|
||||
} ;
|
||||
|
||||
node* _head;
|
||||
AICharPool();
|
||||
~AICharPool();
|
||||
void append(AICharacter *ai_ch);
|
||||
void del(string name);
|
||||
void print_list();
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A class that implements the virtual AI world which keeps track of the AI
|
||||
* characters active at any given time. It contains a linked list of AI
|
||||
|
|
@ -51,7 +30,8 @@ class EXPCL_PANDAAI AICharPool {
|
|||
*/
|
||||
class EXPCL_PANDAAI AIWorld {
|
||||
private:
|
||||
AICharPool * _ai_char_pool;
|
||||
typedef std::vector<PT(AICharacter)> AICharPool;
|
||||
AICharPool _ai_char_pool;
|
||||
NodePath _render;
|
||||
public:
|
||||
vector<NodePath> _obstacles;
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public:
|
|||
unsigned int _alignment_wt;
|
||||
|
||||
// This vector will hold all the ai characters which belong to this flock.
|
||||
typedef std::vector<AICharacter*> AICharList;
|
||||
typedef std::vector<PT(AICharacter)> AICharList;
|
||||
AICharList _ai_char_list;
|
||||
|
||||
PUBLISHED:
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
__all__ = ['Audio3DManager']
|
||||
|
||||
from panda3d.core import Vec3, VBase3
|
||||
from direct.task import Task
|
||||
from panda3d.core import Vec3, VBase3, WeakNodePath
|
||||
from direct.task.TaskManagerGlobal import Task, taskMgr
|
||||
#
|
||||
class Audio3DManager:
|
||||
|
||||
|
|
@ -181,7 +181,8 @@ class Audio3DManager:
|
|||
|
||||
def attachSoundToObject(self, sound, object):
|
||||
"""
|
||||
Sound will come from the location of the object it is attached to
|
||||
Sound will come from the location of the object it is attached to.
|
||||
If the object is deleted, the sound will automatically be removed.
|
||||
"""
|
||||
# sound is an AudioSound
|
||||
# object is any Panda object with coordinates
|
||||
|
|
@ -197,7 +198,7 @@ class Audio3DManager:
|
|||
del self.sound_dict[known_object]
|
||||
|
||||
if object not in self.sound_dict:
|
||||
self.sound_dict[object] = []
|
||||
self.sound_dict[WeakNodePath(object)] = []
|
||||
|
||||
self.sound_dict[object].append(sound)
|
||||
return 1
|
||||
|
|
@ -258,14 +259,18 @@ class Audio3DManager:
|
|||
if self.audio_manager.getActive()==0:
|
||||
return Task.cont
|
||||
|
||||
for known_object in list(self.sound_dict.keys()):
|
||||
tracked_sound = 0
|
||||
while tracked_sound < len(self.sound_dict[known_object]):
|
||||
sound = self.sound_dict[known_object][tracked_sound]
|
||||
pos = known_object.getPos(self.root)
|
||||
for known_object, sounds in list(self.sound_dict.items()):
|
||||
node_path = known_object.getNodePath()
|
||||
if not node_path:
|
||||
# The node has been deleted.
|
||||
del self.sound_dict[known_object]
|
||||
continue
|
||||
|
||||
pos = node_path.getPos(self.root)
|
||||
|
||||
for sound in sounds:
|
||||
vel = self.getSoundVelocity(sound)
|
||||
sound.set3dAttributes(pos[0], pos[1], pos[2], vel[0], vel[1], vel[2])
|
||||
tracked_sound += 1
|
||||
|
||||
# Update the position of the listener based on the object
|
||||
# to which it is attached
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ virtual file system. """
|
|||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import fnmatch
|
||||
|
||||
from direct.stdpy import file
|
||||
|
|
@ -76,7 +75,27 @@ def glob0(dirname, basename):
|
|||
return []
|
||||
|
||||
|
||||
magic_check = re.compile('[*?[]')
|
||||
|
||||
def has_magic(s):
|
||||
return magic_check.search(s) is not None
|
||||
if isinstance(s, bytes):
|
||||
return b'*' in s or b'?' in s or b'[' in s
|
||||
else:
|
||||
return '*' in s or '?' in s or '[' in s
|
||||
|
||||
def escape(pathname):
|
||||
drive, pathname = os.path.splitdrive(pathname)
|
||||
if sys.version_info >= (3, 0) and isinstance(pathname, bytes):
|
||||
newpath = bytearray(drive)
|
||||
for c in pathname:
|
||||
if c == 42 or c == 63 or c == 91:
|
||||
newpath += bytes((91, c, 93))
|
||||
else:
|
||||
newpath.append(c)
|
||||
return bytes(newpath)
|
||||
else:
|
||||
newpath = drive
|
||||
for c in pathname:
|
||||
if c == '*' or c == '?' or c == '[':
|
||||
newpath += '[' + c + ']'
|
||||
else:
|
||||
newpath += c
|
||||
return newpath
|
||||
|
|
|
|||
|
|
@ -30,10 +30,13 @@ dec(TVOLATILE AtomicAdjustDummyImpl::Integer &var) {
|
|||
|
||||
/**
|
||||
* Atomically computes var += delta. It is legal for delta to be negative.
|
||||
* Returns the result of the addition.
|
||||
*/
|
||||
ALWAYS_INLINE void AtomicAdjustDummyImpl::
|
||||
ALWAYS_INLINE AtomicAdjustDummyImpl::Integer AtomicAdjustDummyImpl::
|
||||
add(TVOLATILE AtomicAdjustDummyImpl::Integer &var, AtomicAdjustDummyImpl::Integer delta) {
|
||||
var += delta;
|
||||
Integer new_value = var + delta;
|
||||
var = new_value;
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public:
|
|||
|
||||
ALWAYS_INLINE static void inc(TVOLATILE Integer &var);
|
||||
ALWAYS_INLINE static bool dec(TVOLATILE Integer &var);
|
||||
ALWAYS_INLINE static void add(TVOLATILE Integer &var, Integer delta);
|
||||
ALWAYS_INLINE static Integer add(TVOLATILE Integer &var, Integer delta);
|
||||
ALWAYS_INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
|
||||
ALWAYS_INLINE static Integer get(const TVOLATILE Integer &var);
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,12 @@ dec(TVOLATILE AtomicAdjustGccImpl::Integer &var) {
|
|||
|
||||
/**
|
||||
* Atomically computes var += delta. It is legal for delta to be negative.
|
||||
* Returns the result of the addition.
|
||||
*/
|
||||
INLINE void AtomicAdjustGccImpl::
|
||||
INLINE AtomicAdjustGccImpl::Integer AtomicAdjustGccImpl::
|
||||
add(TVOLATILE AtomicAdjustGccImpl::Integer &var,
|
||||
AtomicAdjustGccImpl::Integer delta) {
|
||||
__atomic_fetch_add(&var, delta, __ATOMIC_SEQ_CST);
|
||||
return __atomic_add_fetch(&var, delta, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
INLINE static void inc(TVOLATILE Integer &var);
|
||||
INLINE static bool dec(TVOLATILE Integer &var);
|
||||
INLINE static void add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
|
||||
INLINE static Integer get(const TVOLATILE Integer &var);
|
||||
|
||||
|
|
|
|||
|
|
@ -59,14 +59,18 @@ dec(TVOLATILE AtomicAdjustI386Impl::Integer &var) {
|
|||
|
||||
/**
|
||||
* Atomically computes var += delta. It is legal for delta to be negative.
|
||||
* Returns the result of the addition.
|
||||
*/
|
||||
INLINE void AtomicAdjustI386Impl::
|
||||
INLINE AtomicAdjustI386Impl::Integer AtomicAdjustI386Impl::
|
||||
add(TVOLATILE AtomicAdjustI386Impl::Integer &var, AtomicAdjustI386Impl::Integer delta) {
|
||||
assert((((size_t)&var) & (sizeof(Integer) - 1)) == 0);
|
||||
Integer orig_value = var;
|
||||
while (compare_and_exchange(var, orig_value, orig_value + delta) != orig_value) {
|
||||
Integer new_value = orig_value + delta;
|
||||
while (compare_and_exchange(var, orig_value, new_value) != orig_value) {
|
||||
orig_value = var;
|
||||
new_value = orig_value + delta;
|
||||
}
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ public:
|
|||
|
||||
INLINE static void inc(TVOLATILE Integer &var);
|
||||
INLINE static bool dec(TVOLATILE Integer &var);
|
||||
INLINE static void add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
|
||||
INLINE static Integer get(const TVOLATILE Integer &var);
|
||||
|
||||
|
|
|
|||
|
|
@ -35,13 +35,16 @@ dec(TVOLATILE AtomicAdjustPosixImpl::Integer &var) {
|
|||
|
||||
/**
|
||||
* Atomically computes var += delta. It is legal for delta to be negative.
|
||||
* Returns the result of the addition.
|
||||
*/
|
||||
INLINE void AtomicAdjustPosixImpl::
|
||||
INLINE AtomicAdjustPosixImpl::Integer AtomicAdjustPosixImpl::
|
||||
add(TVOLATILE AtomicAdjustPosixImpl::Integer &var,
|
||||
AtomicAdjustPosixImpl::Integer delta) {
|
||||
pthread_mutex_lock(&_mutex);
|
||||
var += delta;
|
||||
Integer new_value = var + delta;
|
||||
var = new_value;
|
||||
pthread_mutex_unlock(&_mutex);
|
||||
return new_value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public:
|
|||
|
||||
INLINE static void inc(TVOLATILE Integer &var);
|
||||
INLINE static bool dec(TVOLATILE Integer &var);
|
||||
INLINE static void add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
|
||||
INLINE static Integer get(const TVOLATILE Integer &var);
|
||||
|
||||
|
|
|
|||
|
|
@ -40,17 +40,21 @@ dec(TVOLATILE AtomicAdjustWin32Impl::Integer &var) {
|
|||
|
||||
/**
|
||||
* Atomically computes var += delta. It is legal for delta to be negative.
|
||||
* Returns the result of the addition.
|
||||
*/
|
||||
INLINE void AtomicAdjustWin32Impl::
|
||||
INLINE AtomicAdjustWin32Impl::Integer AtomicAdjustWin32Impl::
|
||||
add(TVOLATILE AtomicAdjustWin32Impl::Integer &var, AtomicAdjustWin32Impl::Integer delta) {
|
||||
assert((((size_t)&var) & (sizeof(Integer) - 1)) == 0);
|
||||
#ifdef _WIN64
|
||||
InterlockedAdd64(&var, delta);
|
||||
return InterlockedAdd64(&var, delta);
|
||||
#else
|
||||
AtomicAdjustWin32Impl::Integer orig_value = var;
|
||||
while (compare_and_exchange(var, orig_value, orig_value + delta) != orig_value) {
|
||||
Integer orig_value = var;
|
||||
Integer new_value = orig_value + delta;
|
||||
while (compare_and_exchange(var, orig_value, new_value) != orig_value) {
|
||||
orig_value = var;
|
||||
new_value = orig_value + delta;
|
||||
}
|
||||
return new_value;
|
||||
#endif // _WIN64
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public:
|
|||
|
||||
ALWAYS_INLINE static void inc(TVOLATILE Integer &var);
|
||||
ALWAYS_INLINE static bool dec(TVOLATILE Integer &var);
|
||||
INLINE static void add(TVOLATILE Integer &var, Integer delta);
|
||||
INLINE static Integer add(TVOLATILE Integer &var, Integer delta);
|
||||
ALWAYS_INLINE static Integer set(TVOLATILE Integer &var, Integer new_value);
|
||||
ALWAYS_INLINE static Integer get(const TVOLATILE Integer &var);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ allocate(size_t size, TypeHandle type_handle) {
|
|||
|
||||
ObjectNode *obj;
|
||||
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
if (_deleted_chain != (ObjectNode *)NULL) {
|
||||
obj = _deleted_chain;
|
||||
_deleted_chain = _deleted_chain->_next;
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
|
||||
#ifdef USE_DELETEDCHAINFLAG
|
||||
assert(obj->_flag == (AtomicAdjust::Integer)DCF_deleted);
|
||||
|
|
@ -64,7 +64,7 @@ allocate(size_t size, TypeHandle type_handle) {
|
|||
|
||||
return ptr;
|
||||
}
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
|
||||
// If we get here, the deleted_chain is empty; we have to allocate a new
|
||||
// object from the system pool.
|
||||
|
|
@ -126,12 +126,12 @@ deallocate(void *ptr, TypeHandle type_handle) {
|
|||
assert(orig_flag == (AtomicAdjust::Integer)DCF_alive);
|
||||
#endif // USE_DELETEDCHAINFLAG
|
||||
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
|
||||
obj->_next = _deleted_chain;
|
||||
_deleted_chain = obj;
|
||||
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
|
||||
#else // USE_DELETED_CHAIN
|
||||
PANDA_FREE_SINGLE(ptr);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,13 @@
|
|||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load any DLL will fail if they inadvertently link with the wrong version of
|
||||
// dtool, which, transitively, means all DLLs must be from the same
|
||||
// (ABI-compatible) version of Panda.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
#ifdef USE_TAU
|
||||
// Tau provides this destructive version of stdbool.h that we must mask.
|
||||
#define __PDT_STDBOOL_H_
|
||||
|
|
@ -33,16 +40,7 @@ using namespace std;
|
|||
#define INLINE inline
|
||||
#define ALWAYS_INLINE inline
|
||||
#define TYPENAME typename
|
||||
#define CONSTEXPR constexpr
|
||||
#define ALWAYS_INLINE_CONSTEXPR constexpr
|
||||
#define NOEXCEPT noexcept
|
||||
#define FINAL final
|
||||
#define MOVE(x) x
|
||||
#define DEFAULT_CTOR = default
|
||||
#define DEFAULT_DTOR = default
|
||||
#define DEFAULT_ASSIGN = default
|
||||
#define DELETED = delete
|
||||
#define DELETED_ASSIGN = delete
|
||||
|
||||
#define EXPORT_TEMPLATE_CLASS(expcl, exptp, classname)
|
||||
|
||||
|
|
@ -81,15 +79,9 @@ typedef int ios_seekdir;
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#ifdef HAVE_NAMESPACE
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_TYPENAME
|
||||
#define TYPENAME typename
|
||||
#else
|
||||
#define TYPENAME
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_WCHAR_T
|
||||
// Some C++ libraries (os x 3.1) don't define this.
|
||||
|
|
@ -124,18 +116,20 @@ typedef ios::seekdir ios_seekdir;
|
|||
#if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719
|
||||
#include <tr1/tuple>
|
||||
|
||||
using std::tr1::tuple;
|
||||
using std::tr1::tie;
|
||||
namespace std {
|
||||
using std::tr1::tuple;
|
||||
using std::tr1::tie;
|
||||
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
typedef decltype(nullptr) nullptr_t;
|
||||
|
||||
template<class T> struct remove_reference {typedef T type;};
|
||||
template<class T> struct remove_reference<T&> {typedef T type;};
|
||||
template<class T> struct remove_reference<T&& >{typedef T type;};
|
||||
template<class T> struct remove_reference {typedef T type;};
|
||||
template<class T> struct remove_reference<T&> {typedef T type;};
|
||||
template<class T> struct remove_reference<T&& >{typedef T type;};
|
||||
|
||||
template<class T> typename remove_reference<T>::type &&move(T &&t) {
|
||||
return static_cast<typename remove_reference<T>::type&&>(t);
|
||||
}
|
||||
template<class T> typename remove_reference<T>::type &&move(T &&t) {
|
||||
return static_cast<typename remove_reference<T>::type&&>(t);
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
|
@ -156,110 +150,12 @@ template<class T> typename remove_reference<T>::type &&move(T &&t) {
|
|||
#endif
|
||||
|
||||
// Determine the availability of C++11 features.
|
||||
#if defined(__has_extension) // Clang magic.
|
||||
# if __has_extension(cxx_constexpr)
|
||||
# if !defined(__apple_build_version__) || __apple_build_version__ >= 5000000
|
||||
# define CONSTEXPR constexpr
|
||||
# endif
|
||||
# endif
|
||||
# if __has_extension(cxx_noexcept)
|
||||
# define NOEXCEPT noexcept
|
||||
# endif
|
||||
# if __has_extension(cxx_rvalue_references) && (__cplusplus >= 201103L)
|
||||
# define USE_MOVE_SEMANTICS
|
||||
# define MOVE(x) move(x)
|
||||
# endif
|
||||
# if __has_extension(cxx_override_control) && (__cplusplus >= 201103L)
|
||||
# define FINAL final
|
||||
# endif
|
||||
# if __has_extension(cxx_defaulted_functions)
|
||||
# define DEFAULT_CTOR = default
|
||||
# define DEFAULT_DTOR = default
|
||||
# define DEFAULT_ASSIGN = default
|
||||
# endif
|
||||
# if __has_extension(cxx_deleted_functions)
|
||||
# define DELETED = delete
|
||||
# endif
|
||||
#elif defined(__GNUC__) // GCC
|
||||
|
||||
// Starting at GCC 4.4
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
|
||||
# define DEFAULT_CTOR = default
|
||||
# define DEFAULT_DTOR = default
|
||||
# define DEFAULT_ASSIGN = default
|
||||
# define DELETED = delete
|
||||
# endif
|
||||
|
||||
// Starting at GCC 4.6
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
|
||||
# define CONSTEXPR constexpr
|
||||
# define NOEXCEPT noexcept
|
||||
# define USE_MOVE_SEMANTICS
|
||||
# define MOVE(x) move(x)
|
||||
# endif
|
||||
|
||||
// Starting at GCC 4.7
|
||||
# if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
|
||||
# define FINAL final
|
||||
# endif
|
||||
|
||||
// GCC defines several macros which we can query. List of all supported
|
||||
// builtin macros: https://gcc.gnu.org/projects/cxx-status.html
|
||||
# if !defined(CONSTEXPR) && __cpp_constexpr >= 200704
|
||||
# define CONSTEXPR constexpr
|
||||
# endif
|
||||
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900 // Visual Studio 2015
|
||||
# define CONSTEXPR constexpr
|
||||
# define NOEXCEPT noexcept
|
||||
# define USE_MOVE_SEMANTICS
|
||||
# define FINAL final
|
||||
# define MOVE(x) move(x)
|
||||
#elif defined(_MSC_VER) && _MSC_VER >= 1600 // Visual Studio 2010
|
||||
# define NOEXCEPT throw()
|
||||
# define USE_MOVE_SEMANTICS
|
||||
# define FINAL sealed
|
||||
# define MOVE(x) move(x)
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1900 // Visual Studio 2015
|
||||
#error Microsoft Visual C++ 2015 or later is required to compile Panda3D.
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1800 // Visual Studio 2013
|
||||
# define DEFAULT_CTOR = default
|
||||
# define DEFAULT_DTOR = default
|
||||
# define DEFAULT_ASSIGN = default
|
||||
# define DELETED = delete
|
||||
#endif
|
||||
|
||||
// Fallbacks if features are not supported
|
||||
#ifndef CONSTEXPR
|
||||
# define CONSTEXPR INLINE
|
||||
# define ALWAYS_INLINE_CONSTEXPR ALWAYS_INLINE
|
||||
#else
|
||||
# define ALWAYS_INLINE_CONSTEXPR ALWAYS_INLINE CONSTEXPR
|
||||
#endif
|
||||
#ifndef NOEXCEPT
|
||||
# define NOEXCEPT
|
||||
#endif
|
||||
#ifndef MOVE
|
||||
# define MOVE(x) x
|
||||
#endif
|
||||
#ifndef FINAL
|
||||
# define FINAL
|
||||
#endif
|
||||
#ifndef DEFAULT_CTOR
|
||||
# define DEFAULT_CTOR {}
|
||||
#endif
|
||||
#ifndef DEFAULT_DTOR
|
||||
# define DEFAULT_DTOR {}
|
||||
#endif
|
||||
#ifndef DEFAULT_ASSIGN
|
||||
# define DEFAULT_ASSIGN {return *this;}
|
||||
#endif
|
||||
#ifndef DELETED
|
||||
# define DELETED {assert(false);}
|
||||
# define DELETED_ASSIGN {assert(false);return *this;}
|
||||
#else
|
||||
# define DELETED_ASSIGN DELETED
|
||||
#endif
|
||||
// This is just to support code generated with older versions of interrogate.
|
||||
#define MOVE(x) (std::move(x))
|
||||
|
||||
|
||||
#ifndef LINK_ALL_STATIC
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
#include <string.h>
|
||||
#include <string>
|
||||
|
||||
#ifdef HAVE_NAMESPACE
|
||||
using namespace std;
|
||||
#endif
|
||||
|
||||
class fake_istream_buffer {
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -34,15 +34,6 @@ dec_heap(size_t size) {
|
|||
#endif // DO_MEMORY_USAGE
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the global memory alignment. This is the number of bytes at which
|
||||
* each allocated memory pointer will be aligned.
|
||||
*/
|
||||
CONSTEXPR size_t MemoryHook::
|
||||
get_memory_alignment() {
|
||||
return MEMORY_HOOK_ALIGNMENT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the operating system page size. This is the minimum granularity
|
||||
* required for calls to mmap_alloc(). Also see round_up_to_page_size().
|
||||
|
|
|
|||
|
|
@ -223,9 +223,9 @@ MemoryHook(const MemoryHook ©) :
|
|||
_total_mmap_size(copy._total_mmap_size),
|
||||
_max_heap_size(copy._max_heap_size) {
|
||||
|
||||
copy._lock.acquire();
|
||||
copy._lock.lock();
|
||||
_deleted_chains = copy._deleted_chains;
|
||||
copy._lock.release();
|
||||
copy._lock.unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -249,9 +249,9 @@ heap_alloc_single(size_t size) {
|
|||
size_t inflated_size = inflate_size(size);
|
||||
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
void *alloc = call_malloc(inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
void *alloc = call_malloc(inflated_size);
|
||||
#endif
|
||||
|
|
@ -259,9 +259,9 @@ heap_alloc_single(size_t size) {
|
|||
while (alloc == (void *)NULL) {
|
||||
alloc_fail(inflated_size);
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
alloc = call_malloc(inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
alloc = call_malloc(inflated_size);
|
||||
#endif
|
||||
|
|
@ -305,9 +305,9 @@ heap_free_single(void *ptr) {
|
|||
#endif // DO_MEMORY_USAGE
|
||||
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
call_free(alloc);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
call_free(alloc);
|
||||
#endif
|
||||
|
|
@ -326,9 +326,9 @@ heap_alloc_array(size_t size) {
|
|||
size_t inflated_size = inflate_size(size);
|
||||
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
void *alloc = call_malloc(inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
void *alloc = call_malloc(inflated_size);
|
||||
#endif
|
||||
|
|
@ -336,9 +336,9 @@ heap_alloc_array(size_t size) {
|
|||
while (alloc == (void *)NULL) {
|
||||
alloc_fail(inflated_size);
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
alloc = call_malloc(inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
alloc = call_malloc(inflated_size);
|
||||
#endif
|
||||
|
|
@ -380,9 +380,9 @@ heap_realloc_array(void *ptr, size_t size) {
|
|||
|
||||
void *alloc1 = alloc;
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
alloc1 = call_realloc(alloc1, inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
alloc1 = call_realloc(alloc1, inflated_size);
|
||||
#endif
|
||||
|
|
@ -394,9 +394,9 @@ heap_realloc_array(void *ptr, size_t size) {
|
|||
alloc1 = alloc;
|
||||
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
alloc1 = call_realloc(alloc1, inflated_size);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
alloc1 = call_realloc(alloc1, inflated_size);
|
||||
#endif
|
||||
|
|
@ -453,9 +453,9 @@ heap_free_array(void *ptr) {
|
|||
#endif // DO_MEMORY_USAGE
|
||||
|
||||
#ifdef MEMORY_HOOK_MALLOC_LOCK
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
call_free(alloc);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#else
|
||||
call_free(alloc);
|
||||
#endif
|
||||
|
|
@ -478,11 +478,11 @@ heap_trim(size_t pad) {
|
|||
// Since malloc_trim() isn't standard C, we can't be sure it exists on a
|
||||
// given platform. But if we're using dlmalloc, we know we have
|
||||
// dlmalloc_trim.
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
if (dlmalloc_trim(pad)) {
|
||||
trimmed = true;
|
||||
}
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
|
|
@ -596,7 +596,7 @@ DeletedBufferChain *MemoryHook::
|
|||
get_deleted_chain(size_t buffer_size) {
|
||||
DeletedBufferChain *chain;
|
||||
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
DeletedChains::iterator dci = _deleted_chains.find(buffer_size);
|
||||
if (dci != _deleted_chains.end()) {
|
||||
chain = (*dci).second;
|
||||
|
|
@ -606,7 +606,7 @@ get_deleted_chain(size_t buffer_size) {
|
|||
_deleted_chains.insert(DeletedChains::value_type(buffer_size, chain));
|
||||
}
|
||||
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
return chain;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,9 @@ public:
|
|||
|
||||
bool heap_trim(size_t pad);
|
||||
|
||||
CONSTEXPR static size_t get_memory_alignment();
|
||||
constexpr static size_t get_memory_alignment() {
|
||||
return MEMORY_HOOK_ALIGNMENT;
|
||||
}
|
||||
|
||||
virtual void *mmap_alloc(size_t size, bool allow_exec);
|
||||
virtual void mmap_free(void *ptr, size_t size);
|
||||
|
|
|
|||
|
|
@ -15,14 +15,14 @@
|
|||
*
|
||||
*/
|
||||
ALWAYS_INLINE void MutexDummyImpl::
|
||||
acquire() {
|
||||
lock() {
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
ALWAYS_INLINE bool MutexDummyImpl::
|
||||
try_acquire() {
|
||||
try_lock() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -30,5 +30,5 @@ try_acquire() {
|
|||
*
|
||||
*/
|
||||
ALWAYS_INLINE void MutexDummyImpl::
|
||||
release() {
|
||||
unlock() {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,16 +23,15 @@
|
|||
*/
|
||||
class EXPCL_DTOOL_DTOOLBASE MutexDummyImpl {
|
||||
public:
|
||||
CONSTEXPR MutexDummyImpl() DEFAULT_CTOR;
|
||||
constexpr MutexDummyImpl() = default;
|
||||
MutexDummyImpl(const MutexDummyImpl ©) = delete;
|
||||
|
||||
private:
|
||||
MutexDummyImpl(const MutexDummyImpl ©) DELETED;
|
||||
MutexDummyImpl &operator = (const MutexDummyImpl ©) DELETED_ASSIGN;
|
||||
MutexDummyImpl &operator = (const MutexDummyImpl ©) = delete;
|
||||
|
||||
public:
|
||||
ALWAYS_INLINE void acquire();
|
||||
ALWAYS_INLINE bool try_acquire();
|
||||
ALWAYS_INLINE void release();
|
||||
ALWAYS_INLINE void lock();
|
||||
ALWAYS_INLINE bool try_lock();
|
||||
ALWAYS_INLINE void unlock();
|
||||
};
|
||||
|
||||
#include "mutexDummyImpl.I"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
CONSTEXPR MutexPosixImpl::
|
||||
MutexPosixImpl() NOEXCEPT : _lock(PTHREAD_MUTEX_INITIALIZER) {
|
||||
constexpr MutexPosixImpl::
|
||||
MutexPosixImpl() noexcept : _lock(PTHREAD_MUTEX_INITIALIZER) {
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -32,8 +32,8 @@ INLINE MutexPosixImpl::
|
|||
*
|
||||
*/
|
||||
INLINE void MutexPosixImpl::
|
||||
acquire() {
|
||||
TAU_PROFILE("void MutexPosixImpl::acquire", " ", TAU_USER);
|
||||
lock() {
|
||||
TAU_PROFILE("void MutexPosixImpl::lock", " ", TAU_USER);
|
||||
int result = pthread_mutex_lock(&_lock);
|
||||
assert(result == 0);
|
||||
}
|
||||
|
|
@ -42,8 +42,8 @@ acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE bool MutexPosixImpl::
|
||||
try_acquire() {
|
||||
TAU_PROFILE("bool MutexPosixImpl::try_acquire", " ", TAU_USER);
|
||||
try_lock() {
|
||||
TAU_PROFILE("bool MutexPosixImpl::try_lock", " ", TAU_USER);
|
||||
int result = pthread_mutex_trylock(&_lock);
|
||||
assert(result == 0 || result == EBUSY);
|
||||
return (result == 0);
|
||||
|
|
@ -53,26 +53,18 @@ try_acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE void MutexPosixImpl::
|
||||
release() {
|
||||
TAU_PROFILE("void MutexPosixImpl::release", " ", TAU_USER);
|
||||
unlock() {
|
||||
TAU_PROFILE("void MutexPosixImpl::unlock", " ", TAU_USER);
|
||||
int result = pthread_mutex_unlock(&_lock);
|
||||
assert(result == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying Posix lock handle.
|
||||
*/
|
||||
INLINE pthread_mutex_t *MutexPosixImpl::
|
||||
get_posix_lock() {
|
||||
return &_lock;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
CONSTEXPR ReMutexPosixImpl::
|
||||
ReMutexPosixImpl() NOEXCEPT : _lock(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) {
|
||||
constexpr ReMutexPosixImpl::
|
||||
ReMutexPosixImpl() noexcept : _lock(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) {
|
||||
}
|
||||
#else
|
||||
INLINE ReMutexPosixImpl::
|
||||
|
|
@ -101,8 +93,8 @@ INLINE ReMutexPosixImpl::
|
|||
*
|
||||
*/
|
||||
INLINE void ReMutexPosixImpl::
|
||||
acquire() {
|
||||
TAU_PROFILE("void ReMutexPosixImpl::acquire", " ", TAU_USER);
|
||||
lock() {
|
||||
TAU_PROFILE("void ReMutexPosixImpl::lock", " ", TAU_USER);
|
||||
int result = pthread_mutex_lock(&_lock);
|
||||
assert(result == 0);
|
||||
}
|
||||
|
|
@ -111,8 +103,8 @@ acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE bool ReMutexPosixImpl::
|
||||
try_acquire() {
|
||||
TAU_PROFILE("bool ReMutexPosixImpl::try_acquire", " ", TAU_USER);
|
||||
try_lock() {
|
||||
TAU_PROFILE("bool ReMutexPosixImpl::try_lock", " ", TAU_USER);
|
||||
int result = pthread_mutex_trylock(&_lock);
|
||||
assert(result == 0 || result == EBUSY);
|
||||
return (result == 0);
|
||||
|
|
@ -122,16 +114,8 @@ try_acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE void ReMutexPosixImpl::
|
||||
release() {
|
||||
TAU_PROFILE("void ReMutexPosixImpl::release", " ", TAU_USER);
|
||||
unlock() {
|
||||
TAU_PROFILE("void ReMutexPosixImpl::unlock", " ", TAU_USER);
|
||||
int result = pthread_mutex_unlock(&_lock);
|
||||
assert(result == 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the underlying Posix lock handle.
|
||||
*/
|
||||
INLINE pthread_mutex_t *ReMutexPosixImpl::
|
||||
get_posix_lock() {
|
||||
return &_lock;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,19 +28,16 @@
|
|||
*/
|
||||
class EXPCL_DTOOL_DTOOLBASE MutexPosixImpl {
|
||||
public:
|
||||
CONSTEXPR MutexPosixImpl() NOEXCEPT;
|
||||
constexpr MutexPosixImpl() noexcept;
|
||||
MutexPosixImpl(const MutexPosixImpl ©) = delete;
|
||||
INLINE ~MutexPosixImpl();
|
||||
|
||||
private:
|
||||
MutexPosixImpl(const MutexPosixImpl ©) DELETED;
|
||||
MutexPosixImpl &operator = (const MutexPosixImpl ©) DELETED_ASSIGN;
|
||||
MutexPosixImpl &operator = (const MutexPosixImpl ©) = delete;
|
||||
|
||||
public:
|
||||
INLINE void acquire();
|
||||
INLINE bool try_acquire();
|
||||
INLINE void release();
|
||||
|
||||
INLINE pthread_mutex_t *get_posix_lock();
|
||||
INLINE void lock();
|
||||
INLINE bool try_lock();
|
||||
INLINE void unlock();
|
||||
|
||||
private:
|
||||
pthread_mutex_t _lock;
|
||||
|
|
@ -53,22 +50,19 @@ private:
|
|||
class EXPCL_DTOOL_DTOOLBASE ReMutexPosixImpl {
|
||||
public:
|
||||
#ifdef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
|
||||
CONSTEXPR ReMutexPosixImpl() NOEXCEPT;
|
||||
constexpr ReMutexPosixImpl() noexcept;
|
||||
#else
|
||||
INLINE ReMutexPosixImpl();
|
||||
#endif
|
||||
ReMutexPosixImpl(const ReMutexPosixImpl ©) = delete;
|
||||
INLINE ~ReMutexPosixImpl();
|
||||
|
||||
private:
|
||||
ReMutexPosixImpl(const ReMutexPosixImpl ©) DELETED;
|
||||
ReMutexPosixImpl &operator = (const ReMutexPosixImpl ©) DELETED;
|
||||
ReMutexPosixImpl &operator = (const ReMutexPosixImpl ©) = delete;
|
||||
|
||||
public:
|
||||
INLINE void acquire();
|
||||
INLINE bool try_acquire();
|
||||
INLINE void release();
|
||||
|
||||
INLINE pthread_mutex_t *get_posix_lock();
|
||||
INLINE void lock();
|
||||
INLINE bool try_lock();
|
||||
INLINE void unlock();
|
||||
|
||||
private:
|
||||
pthread_mutex_t _lock;
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
CONSTEXPR MutexSpinlockImpl::
|
||||
constexpr MutexSpinlockImpl::
|
||||
MutexSpinlockImpl() : _lock(0) {
|
||||
}
|
||||
|
||||
|
|
@ -22,8 +22,8 @@ MutexSpinlockImpl() : _lock(0) {
|
|||
*
|
||||
*/
|
||||
INLINE void MutexSpinlockImpl::
|
||||
acquire() {
|
||||
if (!try_acquire()) {
|
||||
lock() {
|
||||
if (!try_lock()) {
|
||||
do_lock();
|
||||
}
|
||||
}
|
||||
|
|
@ -32,7 +32,7 @@ acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE bool MutexSpinlockImpl::
|
||||
try_acquire() {
|
||||
try_lock() {
|
||||
return (AtomicAdjust::compare_and_exchange(_lock, 0, 1) == 0);
|
||||
}
|
||||
|
||||
|
|
@ -40,6 +40,6 @@ try_acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE void MutexSpinlockImpl::
|
||||
release() {
|
||||
unlock() {
|
||||
AtomicAdjust::set(_lock, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,15 @@
|
|||
*/
|
||||
class EXPCL_DTOOL_DTOOLBASE MutexSpinlockImpl {
|
||||
public:
|
||||
CONSTEXPR MutexSpinlockImpl();
|
||||
constexpr MutexSpinlockImpl();
|
||||
MutexSpinlockImpl(const MutexSpinlockImpl ©) = delete;
|
||||
|
||||
private:
|
||||
MutexSpinlockImpl(const MutexSpinlockImpl ©) DELETED;
|
||||
MutexSpinlockImpl &operator = (const MutexSpinlockImpl ©) DELETED_ASSIGN;
|
||||
MutexSpinlockImpl &operator = (const MutexSpinlockImpl ©) = delete;
|
||||
|
||||
public:
|
||||
INLINE void acquire();
|
||||
INLINE bool try_acquire();
|
||||
INLINE void release();
|
||||
INLINE void lock();
|
||||
INLINE bool try_lock();
|
||||
INLINE void unlock();
|
||||
|
||||
private:
|
||||
void do_lock();
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ INLINE MutexWin32Impl::
|
|||
*
|
||||
*/
|
||||
INLINE void MutexWin32Impl::
|
||||
acquire() {
|
||||
lock() {
|
||||
EnterCriticalSection(&_lock);
|
||||
}
|
||||
|
||||
|
|
@ -31,7 +31,7 @@ acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE bool MutexWin32Impl::
|
||||
try_acquire() {
|
||||
try_lock() {
|
||||
return (TryEnterCriticalSection(&_lock) != 0);
|
||||
}
|
||||
|
||||
|
|
@ -39,6 +39,6 @@ try_acquire() {
|
|||
*
|
||||
*/
|
||||
INLINE void MutexWin32Impl::
|
||||
release() {
|
||||
unlock() {
|
||||
LeaveCriticalSection(&_lock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,16 +29,15 @@
|
|||
class EXPCL_DTOOL_DTOOLBASE MutexWin32Impl {
|
||||
public:
|
||||
MutexWin32Impl();
|
||||
MutexWin32Impl(const MutexWin32Impl ©) = delete;
|
||||
INLINE ~MutexWin32Impl();
|
||||
|
||||
private:
|
||||
MutexWin32Impl(const MutexWin32Impl ©) DELETED;
|
||||
MutexWin32Impl &operator = (const MutexWin32Impl ©) DELETED_ASSIGN;
|
||||
MutexWin32Impl &operator = (const MutexWin32Impl ©) = delete;
|
||||
|
||||
public:
|
||||
INLINE void acquire();
|
||||
INLINE bool try_acquire();
|
||||
INLINE void release();
|
||||
INLINE void lock();
|
||||
INLINE bool try_lock();
|
||||
INLINE void unlock();
|
||||
|
||||
private:
|
||||
CRITICAL_SECTION _lock;
|
||||
|
|
|
|||
|
|
@ -24,17 +24,17 @@
|
|||
// identifier, and then returning the value of that identifier, seems to lead
|
||||
// to compilation errors (at least in VC7) in which sometimes
|
||||
// IS_THRESHOLD_COMPEQ(a, a, get_nearly_zero_value(a)) != 0.
|
||||
CONSTEXPR double
|
||||
constexpr double
|
||||
get_nearly_zero_value(double) {
|
||||
return 1.0e-12;
|
||||
}
|
||||
|
||||
CONSTEXPR float
|
||||
constexpr float
|
||||
get_nearly_zero_value(float) {
|
||||
return 1.0e-6f;
|
||||
}
|
||||
|
||||
CONSTEXPR int
|
||||
constexpr int
|
||||
get_nearly_zero_value(int) {
|
||||
// This is a bit silly, but we should nevertheless define it in case it is
|
||||
// called for an integer type.
|
||||
|
|
|
|||
|
|
@ -48,9 +48,9 @@ get_total_used() {
|
|||
INLINE size_t NeverFreeMemory::
|
||||
get_total_unused() {
|
||||
NeverFreeMemory *global_ptr = get_global_ptr();
|
||||
global_ptr->_lock.acquire();
|
||||
global_ptr->_lock.lock();
|
||||
size_t total_unused = global_ptr->_total_alloc - global_ptr->_total_used;
|
||||
global_ptr->_lock.release();
|
||||
global_ptr->_lock.unlock();
|
||||
return total_unused;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ NeverFreeMemory() {
|
|||
*/
|
||||
void *NeverFreeMemory::
|
||||
ns_alloc(size_t size) {
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
|
||||
//NB: we no longer do alignment here. The only class that uses this is
|
||||
// DeletedBufferChain, and we can do the alignment potentially more
|
||||
|
|
@ -55,7 +55,7 @@ ns_alloc(size_t size) {
|
|||
if (page._remaining >= min_page_remaining_size) {
|
||||
_pages.insert(page);
|
||||
}
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -71,7 +71,7 @@ ns_alloc(size_t size) {
|
|||
if (page._remaining >= min_page_remaining_size) {
|
||||
_pages.insert(page);
|
||||
}
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
template<class Type>
|
||||
INLINE pallocator_single<Type>::
|
||||
pallocator_single(TypeHandle type_handle) NOEXCEPT :
|
||||
pallocator_single(TypeHandle type_handle) noexcept :
|
||||
_type_handle(type_handle)
|
||||
{
|
||||
}
|
||||
|
|
@ -37,7 +37,7 @@ deallocate(TYPENAME pallocator_single<Type>::pointer p, TYPENAME pallocator_sing
|
|||
|
||||
template<class Type>
|
||||
INLINE pallocator_array<Type>::
|
||||
pallocator_array(TypeHandle type_handle) NOEXCEPT :
|
||||
pallocator_array(TypeHandle type_handle) noexcept :
|
||||
_type_handle(type_handle)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,11 +52,11 @@ public:
|
|||
typedef TYPENAME allocator<Type>::const_reference const_reference;
|
||||
typedef TYPENAME allocator<Type>::size_type size_type;
|
||||
|
||||
INLINE pallocator_single(TypeHandle type_handle) NOEXCEPT;
|
||||
INLINE pallocator_single(TypeHandle type_handle) noexcept;
|
||||
|
||||
// template member functions in VC++ can only be defined in-class.
|
||||
template<class U>
|
||||
INLINE pallocator_single(const pallocator_single<U> ©) NOEXCEPT :
|
||||
INLINE pallocator_single(const pallocator_single<U> ©) noexcept :
|
||||
_type_handle(copy._type_handle) { }
|
||||
|
||||
INLINE Type *allocate(size_type n, allocator<void>::const_pointer hint = 0)
|
||||
|
|
@ -81,11 +81,11 @@ public:
|
|||
typedef TYPENAME allocator<Type>::const_reference const_reference;
|
||||
typedef TYPENAME allocator<Type>::size_type size_type;
|
||||
|
||||
INLINE pallocator_array(TypeHandle type_handle = TypeHandle::none()) NOEXCEPT;
|
||||
INLINE pallocator_array(TypeHandle type_handle = TypeHandle::none()) noexcept;
|
||||
|
||||
// template member functions in VC++ can only be defined in-class.
|
||||
template<class U>
|
||||
INLINE pallocator_array(const pallocator_array<U> ©) NOEXCEPT :
|
||||
INLINE pallocator_array(const pallocator_array<U> ©) noexcept :
|
||||
_type_handle(copy._type_handle) { }
|
||||
|
||||
INLINE Type *allocate(size_type n, allocator<void>::const_pointer hint = 0)
|
||||
|
|
|
|||
|
|
@ -43,27 +43,24 @@ class pvector : public vector<Type, pallocator_array<Type> > {
|
|||
public:
|
||||
typedef pallocator_array<Type> allocator;
|
||||
typedef vector<Type, allocator> base_class;
|
||||
typedef TYPENAME base_class::size_type size_type;
|
||||
typedef typename base_class::size_type size_type;
|
||||
|
||||
explicit pvector(TypeHandle type_handle = pvector_type_handle) : base_class(allocator(type_handle)) { }
|
||||
pvector(const pvector<Type> ©) : base_class(copy) { }
|
||||
pvector(pvector<Type> &&from) noexcept : base_class(move(from)) {};
|
||||
explicit pvector(size_type n, TypeHandle type_handle = pvector_type_handle) : base_class(n, Type(), allocator(type_handle)) { }
|
||||
explicit pvector(size_type n, const Type &value, TypeHandle type_handle = pvector_type_handle) : base_class(n, value, allocator(type_handle)) { }
|
||||
pvector(const Type *begin, const Type *end, TypeHandle type_handle = pvector_type_handle) : base_class(begin, end, allocator(type_handle)) { }
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
pvector(pvector<Type> &&from) NOEXCEPT : base_class(move(from)) {};
|
||||
|
||||
pvector<Type> &operator =(pvector<Type> &&from) NOEXCEPT {
|
||||
base_class::operator =(move(from));
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
pvector<Type> &operator =(const pvector<Type> ©) {
|
||||
base_class::operator =(copy);
|
||||
return *this;
|
||||
}
|
||||
|
||||
pvector<Type> &operator =(pvector<Type> &&from) noexcept {
|
||||
base_class::operator =(move(from));
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
#endif // USE_STL_ALLOCATOR
|
||||
|
|
|
|||
|
|
@ -191,14 +191,6 @@ output(ostream &out) const {
|
|||
out << get_name();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a special zero-valued TypeHandle that is used to indicate no type.
|
||||
*/
|
||||
CONSTEXPR TypeHandle TypeHandle::
|
||||
none() {
|
||||
return TypeHandle(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* TypeHandle::none() evaluates to false, everything else evaluates to true.
|
||||
*/
|
||||
|
|
@ -207,21 +199,10 @@ operator bool () const {
|
|||
return (_index != 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a TypeHandle from a type index without error checking, for use by
|
||||
* internal functions.
|
||||
*
|
||||
* See TypeRegistry::find_type_by_id().
|
||||
*/
|
||||
CONSTEXPR TypeHandle TypeHandle::
|
||||
from_index(int index) {
|
||||
return TypeHandle(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Private constructor for initializing a TypeHandle from an index, used by
|
||||
* none() and by from_index().
|
||||
*/
|
||||
CONSTEXPR TypeHandle::
|
||||
constexpr TypeHandle::
|
||||
TypeHandle(int index) : _index(index) {
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,9 +78,9 @@ class TypedObject;
|
|||
* that ancestry of a particular type may be queried, and the type name may be
|
||||
* retrieved for run-time display.
|
||||
*/
|
||||
class EXPCL_DTOOL_DTOOLBASE TypeHandle FINAL {
|
||||
class EXPCL_DTOOL_DTOOLBASE TypeHandle final {
|
||||
PUBLISHED:
|
||||
TypeHandle() NOEXCEPT DEFAULT_CTOR;
|
||||
TypeHandle() noexcept = default;
|
||||
|
||||
enum MemoryClass {
|
||||
MC_singleton,
|
||||
|
|
@ -129,7 +129,7 @@ PUBLISHED:
|
|||
|
||||
INLINE int get_index() const;
|
||||
INLINE void output(ostream &out) const;
|
||||
CONSTEXPR static TypeHandle none();
|
||||
constexpr static TypeHandle none() { return TypeHandle(0); }
|
||||
INLINE operator bool () const;
|
||||
|
||||
MAKE_PROPERTY(index, get_index);
|
||||
|
|
@ -142,10 +142,10 @@ public:
|
|||
void *reallocate_array(void *ptr, size_t size) RETURNS_ALIGNED(MEMORY_HOOK_ALIGNMENT);
|
||||
void deallocate_array(void *ptr);
|
||||
|
||||
CONSTEXPR static TypeHandle from_index(int index);
|
||||
constexpr static TypeHandle from_index(int index) { return TypeHandle(index); }
|
||||
|
||||
private:
|
||||
CONSTEXPR TypeHandle(int index);
|
||||
constexpr TypeHandle(int index);
|
||||
|
||||
// Only kept temporarily for ABI compatibility.
|
||||
static TypeHandle _none;
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ TypeRegistry *TypeRegistry::_global_pointer = NULL;
|
|||
*/
|
||||
bool TypeRegistry::
|
||||
register_type(TypeHandle &type_handle, const string &name) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
if (type_handle != TypeHandle::none()) {
|
||||
// Here's a type that was already registered. Just make sure everything's
|
||||
|
|
@ -40,7 +40,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
TypeRegistryNode *rnode = look_up(type_handle, NULL);
|
||||
if (&type_handle == &rnode->_ref) {
|
||||
// No problem.
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
assert(rnode->_name == name);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
_derivations_fresh = false;
|
||||
|
||||
type_handle = new_handle;
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return true;
|
||||
}
|
||||
TypeRegistryNode *rnode = (*ri).second;
|
||||
|
|
@ -78,7 +78,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
|
||||
if (type_handle == rnode->_handle) {
|
||||
// No problem.
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return false;
|
||||
}
|
||||
// But wait--the type_handle has changed! We kept a reference to the
|
||||
|
|
@ -87,7 +87,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
// time, but now it's different! Bad juju.
|
||||
cerr << "Reregistering " << name << "\n";
|
||||
type_handle = rnode->_handle;
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -103,7 +103,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
|
||||
type_handle = rnode->_handle;
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ register_type(TypeHandle &type_handle, const string &name) {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
register_dynamic_type(const string &name) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
NameRegistry::iterator ri;
|
||||
ri = _name_registry.find(name);
|
||||
|
|
@ -134,14 +134,14 @@ register_dynamic_type(const string &name) {
|
|||
_name_registry[name] = rnode;
|
||||
_derivations_fresh = false;
|
||||
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return *new_handle;
|
||||
}
|
||||
|
||||
// Return the TypeHandle previously obtained.
|
||||
TypeRegistryNode *rnode = (*ri).second;
|
||||
TypeHandle handle = rnode->_handle;
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
@ -152,7 +152,7 @@ register_dynamic_type(const string &name) {
|
|||
*/
|
||||
void TypeRegistry::
|
||||
record_derivation(TypeHandle child, TypeHandle parent) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
TypeRegistryNode *cnode = look_up(child, NULL);
|
||||
assert(cnode != (TypeRegistryNode *)NULL);
|
||||
|
|
@ -171,7 +171,7 @@ record_derivation(TypeHandle child, TypeHandle parent) {
|
|||
_derivations_fresh = false;
|
||||
}
|
||||
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -182,7 +182,7 @@ record_derivation(TypeHandle child, TypeHandle parent) {
|
|||
*/
|
||||
void TypeRegistry::
|
||||
record_alternate_name(TypeHandle type, const string &name) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
TypeRegistryNode *rnode = look_up(type, (TypedObject *)NULL);
|
||||
if (rnode != (TypeRegistryNode *)NULL) {
|
||||
|
|
@ -190,7 +190,7 @@ record_alternate_name(TypeHandle type, const string &name) {
|
|||
_name_registry.insert(NameRegistry::value_type(name, rnode)).first;
|
||||
|
||||
if ((*ri).second != rnode) {
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
cerr
|
||||
<< "Name " << name << " already assigned to TypeHandle "
|
||||
<< rnode->_name << "; cannot reassign to " << type << "\n";
|
||||
|
|
@ -199,7 +199,7 @@ record_alternate_name(TypeHandle type, const string &name) {
|
|||
|
||||
}
|
||||
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -208,7 +208,7 @@ record_alternate_name(TypeHandle type, const string &name) {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
find_type(const string &name) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
TypeHandle handle = TypeHandle::none();
|
||||
NameRegistry::const_iterator ri;
|
||||
|
|
@ -216,7 +216,7 @@ find_type(const string &name) const {
|
|||
if (ri != _name_registry.end()) {
|
||||
handle = (*ri).second->_handle;
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
@ -248,11 +248,11 @@ find_type_by_id(int id) const {
|
|||
*/
|
||||
string TypeRegistry::
|
||||
get_name(TypeHandle type, TypedObject *object) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeRegistryNode *rnode = look_up(type, object);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
string name = rnode->_name;
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
|
||||
return name;
|
||||
}
|
||||
|
|
@ -273,7 +273,7 @@ get_name(TypeHandle type, TypedObject *object) const {
|
|||
bool TypeRegistry::
|
||||
is_derived_from(TypeHandle child, TypeHandle base,
|
||||
TypedObject *child_object) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
const TypeRegistryNode *child_node = look_up(child, child_object);
|
||||
const TypeRegistryNode *base_node = look_up(base, (TypedObject *)NULL);
|
||||
|
|
@ -284,7 +284,7 @@ is_derived_from(TypeHandle child, TypeHandle base,
|
|||
freshen_derivations();
|
||||
|
||||
bool result = TypeRegistryNode::is_derived_from(child_node, base_node);
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -293,9 +293,9 @@ is_derived_from(TypeHandle child, TypeHandle base,
|
|||
*/
|
||||
int TypeRegistry::
|
||||
get_num_typehandles() {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
int num_types = (int)_handle_registry.size();
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return num_types;
|
||||
}
|
||||
|
||||
|
|
@ -304,12 +304,12 @@ get_num_typehandles() {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
get_typehandle(int n) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeRegistryNode *rnode = NULL;
|
||||
if (n >= 0 && n < (int)_handle_registry.size()) {
|
||||
rnode = _handle_registry[n];
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
|
||||
if (rnode != (TypeRegistryNode *)NULL) {
|
||||
return rnode->_handle;
|
||||
|
|
@ -324,10 +324,10 @@ get_typehandle(int n) {
|
|||
*/
|
||||
int TypeRegistry::
|
||||
get_num_root_classes() {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
freshen_derivations();
|
||||
int num_roots = (int)_root_classes.size();
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return num_roots;
|
||||
}
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ get_num_root_classes() {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
get_root_class(int n) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
freshen_derivations();
|
||||
TypeHandle handle;
|
||||
if (n >= 0 && n < (int)_root_classes.size()) {
|
||||
|
|
@ -344,7 +344,7 @@ get_root_class(int n) {
|
|||
} else {
|
||||
handle = TypeHandle::none();
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
@ -362,11 +362,11 @@ get_root_class(int n) {
|
|||
*/
|
||||
int TypeRegistry::
|
||||
get_num_parent_classes(TypeHandle child, TypedObject *child_object) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeRegistryNode *rnode = look_up(child, child_object);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
int num_parents = (int)rnode->_parent_classes.size();
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return num_parents;
|
||||
}
|
||||
|
||||
|
|
@ -376,7 +376,7 @@ get_num_parent_classes(TypeHandle child, TypedObject *child_object) const {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
get_parent_class(TypeHandle child, int index) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeHandle handle;
|
||||
TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
|
|
@ -385,7 +385,7 @@ get_parent_class(TypeHandle child, int index) const {
|
|||
} else {
|
||||
handle = TypeHandle::none();
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
@ -399,11 +399,11 @@ get_parent_class(TypeHandle child, int index) const {
|
|||
*/
|
||||
int TypeRegistry::
|
||||
get_num_child_classes(TypeHandle child, TypedObject *child_object) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeRegistryNode *rnode = look_up(child, child_object);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
int num_children = (int)rnode->_child_classes.size();
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return num_children;
|
||||
}
|
||||
|
||||
|
|
@ -413,7 +413,7 @@ get_num_child_classes(TypeHandle child, TypedObject *child_object) const {
|
|||
*/
|
||||
TypeHandle TypeRegistry::
|
||||
get_child_class(TypeHandle child, int index) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeHandle handle;
|
||||
TypeRegistryNode *rnode = look_up(child, (TypedObject *)NULL);
|
||||
assert(rnode != (TypeRegistryNode *)NULL);
|
||||
|
|
@ -422,7 +422,7 @@ get_child_class(TypeHandle child, int index) const {
|
|||
} else {
|
||||
handle = TypeHandle::none();
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
@ -439,7 +439,7 @@ get_child_class(TypeHandle child, int index) const {
|
|||
TypeHandle TypeRegistry::
|
||||
get_parent_towards(TypeHandle child, TypeHandle base,
|
||||
TypedObject *child_object) {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
TypeHandle handle;
|
||||
const TypeRegistryNode *child_node = look_up(child, child_object);
|
||||
const TypeRegistryNode *base_node = look_up(base, NULL);
|
||||
|
|
@ -447,7 +447,7 @@ get_parent_towards(TypeHandle child, TypeHandle base,
|
|||
base_node != (TypeRegistryNode *)NULL);
|
||||
freshen_derivations();
|
||||
handle = TypeRegistryNode::get_parent_towards(child_node, base_node);
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
|
@ -462,7 +462,7 @@ get_parent_towards(TypeHandle child, TypeHandle base,
|
|||
void TypeRegistry::
|
||||
reregister_types() {
|
||||
init_lock();
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
HandleRegistry::iterator ri;
|
||||
TypeRegistry *reg = ptr();
|
||||
for (ri = reg->_handle_registry.begin();
|
||||
|
|
@ -473,7 +473,7 @@ reregister_types() {
|
|||
cerr << "Reregistering " << rnode->_name << "\n";
|
||||
}
|
||||
}
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -483,9 +483,9 @@ reregister_types() {
|
|||
*/
|
||||
void TypeRegistry::
|
||||
write(ostream &out) const {
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
do_write(out);
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -613,9 +613,9 @@ look_up_invalid(TypeHandle handle, TypedObject *object) const {
|
|||
// But we're lucky enough to have a TypedObject pointer handy! Maybe we
|
||||
// can use it to resolve the error. We have to drop the lock while we
|
||||
// do this, so we don't get a recursive lock.
|
||||
_lock->release();
|
||||
_lock->unlock();
|
||||
handle = object->force_init_type();
|
||||
_lock->acquire();
|
||||
_lock->lock();
|
||||
|
||||
if (handle._index == 0) {
|
||||
// Strange.
|
||||
|
|
|
|||
|
|
@ -87,9 +87,9 @@
|
|||
*/
|
||||
class EXPCL_DTOOL_DTOOLBASE TypedObject : public MemoryBase {
|
||||
public:
|
||||
INLINE TypedObject() DEFAULT_CTOR;
|
||||
INLINE TypedObject(const TypedObject ©) DEFAULT_CTOR;
|
||||
INLINE TypedObject &operator = (const TypedObject ©) DEFAULT_ASSIGN;
|
||||
INLINE TypedObject() = default;
|
||||
INLINE TypedObject(const TypedObject ©) = default;
|
||||
INLINE TypedObject &operator = (const TypedObject ©) = default;
|
||||
|
||||
PUBLISHED:
|
||||
// A virtual destructor is just a good idea.
|
||||
|
|
|
|||
|
|
@ -54,24 +54,20 @@ Filename(const Filename ©) :
|
|||
{
|
||||
}
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE Filename::
|
||||
Filename(string &&filename) NOEXCEPT {
|
||||
_flags = 0;
|
||||
(*this) = move(filename);
|
||||
Filename(string &&filename) noexcept : _flags(0) {
|
||||
(*this) = std::move(filename);
|
||||
}
|
||||
#endif // USE_MOVE_SEMANTICS
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE Filename::
|
||||
Filename(Filename &&from) NOEXCEPT :
|
||||
_filename(move(from._filename)),
|
||||
Filename(Filename &&from) noexcept :
|
||||
_filename(std::move(from._filename)),
|
||||
_dirname_end(from._dirname_end),
|
||||
_basename_start(from._basename_start),
|
||||
_basename_end(from._basename_end),
|
||||
|
|
@ -81,7 +77,6 @@ Filename(Filename &&from) NOEXCEPT :
|
|||
_flags(from._flags)
|
||||
{
|
||||
}
|
||||
#endif // USE_MOVE_SEMANTICS
|
||||
|
||||
/**
|
||||
* Creates an empty Filename.
|
||||
|
|
@ -217,28 +212,25 @@ operator = (const Filename ©) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE Filename &Filename::
|
||||
operator = (string &&filename) NOEXCEPT {
|
||||
_filename = move(filename);
|
||||
operator = (string &&filename) noexcept {
|
||||
_filename = std::move(filename);
|
||||
|
||||
locate_basename();
|
||||
locate_extension();
|
||||
locate_hash();
|
||||
return *this;
|
||||
}
|
||||
#endif // USE_MOVE_SEMANTICS
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
/**
|
||||
*
|
||||
*/
|
||||
INLINE Filename &Filename::
|
||||
operator = (Filename &&from) NOEXCEPT {
|
||||
_filename = move(from._filename);
|
||||
operator = (Filename &&from) noexcept {
|
||||
_filename = std::move(from._filename);
|
||||
_dirname_end = from._dirname_end;
|
||||
_basename_start = from._basename_start;
|
||||
_basename_end = from._basename_end;
|
||||
|
|
@ -248,7 +240,6 @@ operator = (Filename &&from) NOEXCEPT {
|
|||
_flags = from._flags;
|
||||
return *this;
|
||||
}
|
||||
#endif // USE_MOVE_SEMANTICS
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@
|
|||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__) && !defined(HAVE_LOCKF)
|
||||
#if defined(__ANDROID__) && !defined(PHAVE_LOCKF)
|
||||
// Needed for flock.
|
||||
#include <sys/file.h>
|
||||
#endif
|
||||
|
|
@ -2752,7 +2752,7 @@ atomic_compare_and_exchange_contents(string &orig_contents,
|
|||
|
||||
orig_contents = string();
|
||||
|
||||
#ifdef HAVE_LOCKF
|
||||
#ifdef PHAVE_LOCKF
|
||||
if (lockf(fd, F_LOCK, 0) != 0) {
|
||||
#else
|
||||
if (flock(fd, LOCK_EX) != 0) {
|
||||
|
|
@ -2868,7 +2868,7 @@ atomic_read_contents(string &contents) const {
|
|||
|
||||
contents = string();
|
||||
|
||||
#ifdef HAVE_LOCKF
|
||||
#ifdef PHAVE_LOCKF
|
||||
if (lockf(fd, F_LOCK, 0) != 0) {
|
||||
#else
|
||||
if (flock(fd, LOCK_EX) != 0) {
|
||||
|
|
|
|||
|
|
@ -58,11 +58,8 @@ public:
|
|||
INLINE Filename(const string &filename);
|
||||
INLINE Filename(const wstring &filename);
|
||||
INLINE Filename(const Filename ©);
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
INLINE Filename(string &&filename) NOEXCEPT;
|
||||
INLINE Filename(Filename &&from) NOEXCEPT;
|
||||
#endif
|
||||
INLINE Filename(string &&filename) noexcept;
|
||||
INLINE Filename(Filename &&from) noexcept;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE Filename();
|
||||
|
|
@ -106,11 +103,8 @@ PUBLISHED:
|
|||
INLINE Filename &operator = (const wstring &filename);
|
||||
INLINE Filename &operator = (const char *filename);
|
||||
INLINE Filename &operator = (const Filename ©);
|
||||
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
INLINE Filename &operator = (string &&filename) NOEXCEPT;
|
||||
INLINE Filename &operator = (Filename &&from) NOEXCEPT;
|
||||
#endif
|
||||
INLINE Filename &operator = (string &&filename) noexcept;
|
||||
INLINE Filename &operator = (Filename &&from) noexcept;
|
||||
|
||||
// And retrieval is by any of the classic string operations.
|
||||
INLINE operator const string & () const;
|
||||
|
|
|
|||
|
|
@ -2601,7 +2601,6 @@ write_module_class(ostream &out, Object *obj) {
|
|||
// compare_to function, which is mapped to the tp_compare slot, which
|
||||
// Python 3 no longer has. So, we'll write code to fall back to that if
|
||||
// no matching comparison operator was found.
|
||||
out << "#if PY_MAJOR_VERSION >= 3\n";
|
||||
out << " // All is not lost; we still have the compare_to function to fall back onto.\n";
|
||||
out << " int cmpval = " << slots["tp_compare"]._wrapper_name << "(self, arg);\n";
|
||||
out << " if (cmpval == -1 && _PyErr_OCCURRED()) {\n";
|
||||
|
|
@ -2625,7 +2624,6 @@ write_module_class(ostream &out, Object *obj) {
|
|||
out << " case Py_GE:\n";
|
||||
out << " return PyBool_FromLong(cmpval >= 0);\n";
|
||||
out << " }\n";
|
||||
out << "#endif\n\n";
|
||||
}
|
||||
|
||||
out << " Py_INCREF(Py_NotImplemented);\n";
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ reload_cache() {
|
|||
// thread-safe manner. But chances are that the first time this is called
|
||||
// is at static init time, when there is no risk of data races.
|
||||
static MutexImpl lock;
|
||||
lock.acquire();
|
||||
lock.lock();
|
||||
|
||||
// We check again for cache validity since another thread may have beaten
|
||||
// us to the punch while we were waiting for the lock.
|
||||
|
|
@ -42,5 +42,5 @@ reload_cache() {
|
|||
|
||||
mark_cache_valid(_local_modified);
|
||||
}
|
||||
lock.release();
|
||||
lock.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ reload_cache() {
|
|||
// thread-safe manner. But chances are that the first time this is called
|
||||
// is at static init time, when there is no risk of data races.
|
||||
static MutexImpl lock;
|
||||
lock.acquire();
|
||||
lock.lock();
|
||||
|
||||
// We check again for cache validity since another thread may have beaten
|
||||
// us to the punch while we were waiting for the lock.
|
||||
|
|
@ -31,5 +31,5 @@ reload_cache() {
|
|||
mark_cache_valid(_local_modified);
|
||||
}
|
||||
|
||||
lock.release();
|
||||
lock.unlock();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ is_debug() const {
|
|||
* "debug" severities, and these methods are redefined to be static to make it
|
||||
* more obvious to the compiler.
|
||||
*/
|
||||
CONSTEXPR bool NotifyCategory::
|
||||
constexpr bool NotifyCategory::
|
||||
is_spam() {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -98,7 +98,7 @@ is_spam() {
|
|||
* "debug" severities, and these methods are redefined to be static to make it
|
||||
* more obvious to the compiler.
|
||||
*/
|
||||
CONSTEXPR bool NotifyCategory::
|
||||
constexpr bool NotifyCategory::
|
||||
is_debug() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ PUBLISHED:
|
|||
INLINE bool is_spam() const;
|
||||
INLINE bool is_debug() const;
|
||||
#else
|
||||
CONSTEXPR static bool is_spam();
|
||||
CONSTEXPR static bool is_debug();
|
||||
constexpr static bool is_spam();
|
||||
constexpr static bool is_debug();
|
||||
#endif
|
||||
INLINE bool is_info() const;
|
||||
INLINE bool is_warning() const;
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ is_spam() {
|
|||
}
|
||||
#else
|
||||
template<class GetCategory>
|
||||
CONSTEXPR bool NotifyCategoryProxy<GetCategory>::
|
||||
constexpr bool NotifyCategoryProxy<GetCategory>::
|
||||
is_spam() {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -92,7 +92,7 @@ is_debug() {
|
|||
}
|
||||
#else
|
||||
template<class GetCategory>
|
||||
CONSTEXPR bool NotifyCategoryProxy<GetCategory>::
|
||||
constexpr bool NotifyCategoryProxy<GetCategory>::
|
||||
is_debug() {
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,8 +75,8 @@ public:
|
|||
INLINE bool is_spam();
|
||||
INLINE bool is_debug();
|
||||
#else
|
||||
CONSTEXPR static bool is_spam();
|
||||
CONSTEXPR static bool is_debug();
|
||||
constexpr static bool is_spam();
|
||||
constexpr static bool is_debug();
|
||||
#endif
|
||||
INLINE bool is_info();
|
||||
INLINE bool is_warning();
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ StreamWrapperBase() {
|
|||
*/
|
||||
INLINE void StreamWrapperBase::
|
||||
acquire() {
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
#ifdef SIMPLE_THREADS
|
||||
while (_lock_flag) {
|
||||
thread_yield();
|
||||
|
|
@ -55,7 +55,7 @@ release() {
|
|||
assert(_lock_flag);
|
||||
_lock_flag = false;
|
||||
#endif
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,9 +24,7 @@
|
|||
class EXPCL_DTOOL_PRC StreamWrapperBase {
|
||||
protected:
|
||||
INLINE StreamWrapperBase();
|
||||
|
||||
private:
|
||||
INLINE StreamWrapperBase(const StreamWrapperBase ©) DELETED;
|
||||
INLINE StreamWrapperBase(const StreamWrapperBase ©) = delete;
|
||||
|
||||
PUBLISHED:
|
||||
INLINE void acquire();
|
||||
|
|
|
|||
|
|
@ -315,9 +315,7 @@ def parseopts(args):
|
|||
usage("Invalid SHA-1 hash given for --git-commit option!")
|
||||
|
||||
if GetTarget() == 'windows':
|
||||
show_warning = False
|
||||
if not MSVC_VERSION:
|
||||
show_warning = True
|
||||
print("No MSVC version specified. Defaulting to 14 (Visual Studio 2015).")
|
||||
MSVC_VERSION = (14, 0)
|
||||
else:
|
||||
|
|
@ -325,22 +323,19 @@ def parseopts(args):
|
|||
MSVC_VERSION = tuple(int(d) for d in MSVC_VERSION.split('.'))[:2]
|
||||
if (len(MSVC_VERSION) == 1):
|
||||
MSVC_VERSION += (0,)
|
||||
if MSVC_VERSION < (14, 0):
|
||||
show_warning = True
|
||||
except:
|
||||
usage("Invalid setting for --msvc-version")
|
||||
|
||||
if show_warning:
|
||||
warn_prefix = "%sWARNING:%s " % (GetColor("red"), GetColor())
|
||||
if MSVC_VERSION < (14, 0):
|
||||
warn_prefix = "%sERROR:%s " % (GetColor("red"), GetColor())
|
||||
print("=========================================================================")
|
||||
print(warn_prefix + "Support for MSVC versions before 2015 will soon be discontinued.")
|
||||
print(warn_prefix + "If you wish to keep using MSVC 2010, make your voice heard at:")
|
||||
print(warn_prefix + "Support for MSVC versions before 2015 has been discontinued.")
|
||||
print(warn_prefix + "For more information, or any questions, please visit:")
|
||||
print(warn_prefix + " https://github.com/panda3d/panda3d/issues/288")
|
||||
if MSVC_VERSION >= (14, 0):
|
||||
print(warn_prefix + "To squelch this warning, pass --msvc-version {0}.{1}".format(*MSVC_VERSION))
|
||||
print("=========================================================================")
|
||||
sys.stdout.flush()
|
||||
time.sleep(1.0)
|
||||
sys.exit(1)
|
||||
|
||||
if not WINDOWS_SDK:
|
||||
print("No Windows SDK version specified. Defaulting to '7.1'.")
|
||||
|
|
@ -2272,12 +2267,10 @@ DTOOL_CONFIG=[
|
|||
("DO_PIPELINING", '1', '1'),
|
||||
("DEFAULT_PATHSEP", '";"', '":"'),
|
||||
("WORDS_BIGENDIAN", 'UNDEF', 'UNDEF'),
|
||||
("HAVE_NAMESPACE", '1', '1'),
|
||||
("HAVE_OPEN_MASK", 'UNDEF', 'UNDEF'),
|
||||
("HAVE_LOCKF", '1', '1'),
|
||||
("PHAVE_LOCKF", '1', '1'),
|
||||
("HAVE_WCHAR_T", '1', '1'),
|
||||
("HAVE_WSTRING", '1', '1'),
|
||||
("HAVE_TYPENAME", '1', '1'),
|
||||
("SIMPLE_STRUCT_POINTERS", '1', 'UNDEF'),
|
||||
("HAVE_DINKUM", 'UNDEF', 'UNDEF'),
|
||||
("HAVE_STL_HASH", 'UNDEF', 'UNDEF'),
|
||||
|
|
@ -2452,7 +2445,7 @@ def WriteConfigSettings():
|
|||
# Android does have RTTI, but we disable it anyway.
|
||||
dtool_config["HAVE_RTTI"] = 'UNDEF'
|
||||
dtool_config["PHAVE_GLOB_H"] = 'UNDEF'
|
||||
dtool_config["HAVE_LOCKF"] = 'UNDEF'
|
||||
dtool_config["PHAVE_LOCKF"] = 'UNDEF'
|
||||
dtool_config["HAVE_VIDEO4LINUX"] = 'UNDEF'
|
||||
|
||||
if (GetOptimize() <= 2 and GetTarget() == "windows"):
|
||||
|
|
@ -2613,18 +2606,21 @@ PANDAVERSION_H_RUNTIME="""
|
|||
|
||||
CHECKPANDAVERSION_CXX="""
|
||||
# include "dtoolbase.h"
|
||||
EXPCL_DTOOL_DTOOLUTIL int panda_version_$VERSION1_$VERSION2 = 0;
|
||||
EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2 = 0;
|
||||
"""
|
||||
|
||||
CHECKPANDAVERSION_H="""
|
||||
# ifndef CHECKPANDAVERSION_H
|
||||
# define CHECKPANDAVERSION_H
|
||||
# include "dtoolbase.h"
|
||||
extern EXPCL_DTOOL_DTOOLUTIL int panda_version_$VERSION1_$VERSION2;
|
||||
# ifndef WIN32
|
||||
/* For Windows, exporting the symbol from the DLL is sufficient; the
|
||||
DLL will not load unless all expected public symbols are defined.
|
||||
Other systems may not mind if the symbol is absent unless we
|
||||
explictly write code that references it. */
|
||||
static int check_panda_version = panda_version_$VERSION1_$VERSION2;
|
||||
extern EXPCL_DTOOL_DTOOLBASE int panda_version_$VERSION1_$VERSION2;
|
||||
// Hack to forcibly depend on the check
|
||||
template<typename T>
|
||||
class CheckPandaVersion {
|
||||
public:
|
||||
int check_version() { return panda_version_$VERSION1_$VERSION2; }
|
||||
};
|
||||
template class CheckPandaVersion<void>;
|
||||
# endif
|
||||
"""
|
||||
|
||||
|
|
|
|||
|
|
@ -14,12 +14,6 @@
|
|||
#include "config_pstatclient.h"
|
||||
#endif
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpanda.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
#if !defined(CPPPARSER) && !defined(BUILDING_LIBPANDA)
|
||||
#error Buildsystem error: BUILDING_LIBPANDA not defined
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@
|
|||
#include "pandabullet.h"
|
||||
#include "config_bullet.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandabullet.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@
|
|||
#include "config_dxgsg9.h"
|
||||
#include "wdxGraphicsPipe9.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandadx9.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -9,12 +9,6 @@
|
|||
#include "config_egg.h"
|
||||
#include "config_egg2pg.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaegg.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@
|
|||
|
||||
#include "config_egg.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaegg.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -3,9 +3,3 @@
|
|||
* @author drose
|
||||
* @date 2000-05-15
|
||||
*/
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaexpress.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@
|
|||
|
||||
#include "config_distort.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandafx.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -30,12 +30,6 @@
|
|||
#error One of HAVE_WGL, HAVE_COCOA, HAVE_CARBON or HAVE_GLX must be defined when compiling pandagl!
|
||||
#endif
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandagl.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -17,12 +17,6 @@
|
|||
#include "eglGraphicsPipe.h"
|
||||
#endif
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandagles.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -12,12 +12,6 @@
|
|||
#include "config_egldisplay.h"
|
||||
#include "eglGraphicsPipe.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandagles2.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@
|
|||
#include "pandaode.h"
|
||||
#include "config_ode.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaode.so.dll will fail if they inadvertently link with the wrong
|
||||
// version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -8,12 +8,6 @@
|
|||
#include "config_physics.h"
|
||||
#include "config_particlesystem.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaphysics.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -7,12 +7,6 @@
|
|||
#include "pandaphysx.h"
|
||||
#include "config_physx.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to
|
||||
// load libpandaphysx.so.dll will fail if they inadvertently link with the
|
||||
// wrong version of libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
/**
|
||||
* Initializes the library. This must be called at least once before any of
|
||||
* the functions or classes in this library can be used. Normally it will be
|
||||
|
|
|
|||
|
|
@ -21,12 +21,6 @@
|
|||
#include "bamCache.h"
|
||||
#include "virtualFileSystem.h"
|
||||
|
||||
// By including checkPandaVersion.h, we guarantee that runtime attempts to run
|
||||
// pview will fail if it inadvertently links with the wrong version of
|
||||
// libdtool.so.dll.
|
||||
|
||||
#include "checkPandaVersion.h"
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
PandaFramework framework;
|
||||
framework.open_framework(argc, argv);
|
||||
|
|
|
|||
|
|
@ -134,7 +134,7 @@ BulletSoftBodyNodeElement BulletSoftBodyNode::
|
|||
get_node(int idx) const {
|
||||
LightMutexHolder holder(BulletWorld::get_global_lock());
|
||||
|
||||
nassertr(idx >=0 && idx < get_num_nodes(), BulletSoftBodyNodeElement::empty());
|
||||
nassertr(idx >= 0 && idx < _soft->m_nodes.size(), BulletSoftBodyNodeElement::empty());
|
||||
return BulletSoftBodyNodeElement(_soft->m_nodes[idx]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@
|
|||
class EXPCL_PANDABULLET BulletTriangleMesh : public TypedWritableReferenceCount {
|
||||
PUBLISHED:
|
||||
BulletTriangleMesh();
|
||||
~BulletTriangleMesh() DEFAULT_DTOR;
|
||||
~BulletTriangleMesh() = default;
|
||||
|
||||
void add_triangle(const LPoint3 &p0,
|
||||
const LPoint3 &p1,
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ apply_transform(const TransformState *transform) {
|
|||
if ((*ati).first.is_valid_pointer() &&
|
||||
(*ati).second.is_valid_pointer()) {
|
||||
// Here's our cached result.
|
||||
return (*ati).second.p();
|
||||
return (*ati).second.lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ bool CharacterJoint::
|
|||
remove_net_transform(PandaNode *node) {
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ clear_net_transforms() {
|
|||
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
}
|
||||
|
|
@ -306,7 +306,7 @@ bool CharacterJoint::
|
|||
remove_local_transform(PandaNode *node) {
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
|
||||
|
|
@ -336,7 +336,7 @@ clear_local_transforms() {
|
|||
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
}
|
||||
|
|
@ -427,7 +427,7 @@ set_character(Character *character) {
|
|||
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
}
|
||||
|
|
@ -438,7 +438,7 @@ set_character(Character *character) {
|
|||
|
||||
CPT(RenderEffect) effect = node->get_effect(CharacterJointEffect::get_class_type());
|
||||
if (effect != (RenderEffect *)NULL &&
|
||||
DCAST(CharacterJointEffect, effect)->get_character() == _character) {
|
||||
DCAST(CharacterJointEffect, effect)->matches_character(_character)) {
|
||||
node->clear_effect(CharacterJointEffect::get_class_type());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,17 @@ CharacterJointEffect() {
|
|||
* Returns the Character that will get update() called on it when this node's
|
||||
* relative transform is queried, or NULL if there is no such character.
|
||||
*/
|
||||
INLINE Character *CharacterJointEffect::
|
||||
INLINE PT(Character) CharacterJointEffect::
|
||||
get_character() const {
|
||||
if (_character.is_valid_pointer()) {
|
||||
return _character;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
return _character.lock();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this CharacterJointEffect contains the given Character.
|
||||
* This exists because it is faster to check than get_character() and can even
|
||||
* be called while the Character is destructing.
|
||||
*/
|
||||
INLINE bool CharacterJointEffect::
|
||||
matches_character(Character *character) const {
|
||||
return _character == character;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,8 +89,9 @@ safe_to_combine() const {
|
|||
void CharacterJointEffect::
|
||||
output(ostream &out) const {
|
||||
out << get_type();
|
||||
if (_character.is_valid_pointer()) {
|
||||
out << "(" << _character->get_name() << ")";
|
||||
PT(Character) character = get_character();
|
||||
if (character != nullptr) {
|
||||
out << "(" << character->get_name() << ")";
|
||||
} else {
|
||||
out << "(**invalid**)";
|
||||
}
|
||||
|
|
@ -122,8 +123,8 @@ void CharacterJointEffect::
|
|||
cull_callback(CullTraverser *trav, CullTraverserData &data,
|
||||
CPT(TransformState) &node_transform,
|
||||
CPT(RenderState) &) const {
|
||||
if (_character.is_valid_pointer()) {
|
||||
_character->update();
|
||||
if (auto character = _character.lock()) {
|
||||
character->update();
|
||||
}
|
||||
node_transform = data.node()->get_transform();
|
||||
}
|
||||
|
|
@ -150,8 +151,8 @@ void CharacterJointEffect::
|
|||
adjust_transform(CPT(TransformState) &net_transform,
|
||||
CPT(TransformState) &node_transform,
|
||||
const PandaNode *node) const {
|
||||
if (_character.is_valid_pointer()) {
|
||||
_character->update();
|
||||
if (auto character = _character.lock()) {
|
||||
character->update();
|
||||
}
|
||||
node_transform = node->get_transform();
|
||||
}
|
||||
|
|
@ -202,11 +203,8 @@ void CharacterJointEffect::
|
|||
write_datagram(BamWriter *manager, Datagram &dg) {
|
||||
RenderEffect::write_datagram(manager, dg);
|
||||
|
||||
if (_character.is_valid_pointer()) {
|
||||
manager->write_pointer(dg, _character);
|
||||
} else {
|
||||
manager->write_pointer(dg, NULL);
|
||||
}
|
||||
PT(Character) character = get_character();
|
||||
manager->write_pointer(dg, character);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -38,9 +38,11 @@ private:
|
|||
PUBLISHED:
|
||||
static CPT(RenderEffect) make(Character *character);
|
||||
|
||||
INLINE Character *get_character() const;
|
||||
INLINE PT(Character) get_character() const;
|
||||
|
||||
public:
|
||||
INLINE bool matches_character(Character *character) const;
|
||||
|
||||
virtual bool safe_to_transform() const;
|
||||
virtual bool safe_to_combine() const;
|
||||
virtual void output(ostream &out) const;
|
||||
|
|
|
|||
|
|
@ -479,13 +479,8 @@ INLINE void DisplayRegion::
|
|||
set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup,
|
||||
Thread *current_thread) {
|
||||
CDCullWriter cdata(_cycler_cull, true, current_thread);
|
||||
#ifdef USE_MOVE_SEMANTICS
|
||||
cdata->_cull_result = move(cull_result);
|
||||
cdata->_scene_setup = move(scene_setup);
|
||||
#else
|
||||
swap(cdata->_cull_result, cull_result);
|
||||
swap(cdata->_scene_setup, scene_setup);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -572,22 +567,6 @@ DisplayRegionPipelineReader(DisplayRegion *object, Thread *current_thread) :
|
|||
#endif // _DEBUG
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't attempt to copy these objects.
|
||||
*/
|
||||
INLINE DisplayRegionPipelineReader::
|
||||
DisplayRegionPipelineReader(const DisplayRegionPipelineReader &) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't attempt to copy these objects.
|
||||
*/
|
||||
INLINE void DisplayRegionPipelineReader::
|
||||
operator = (const DisplayRegionPipelineReader &) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -46,25 +46,6 @@ DisplayRegion(GraphicsOutput *window, const LVecBase4 &dimensions) :
|
|||
_window->add_display_region(this);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
DisplayRegion::
|
||||
DisplayRegion(const DisplayRegion ©) :
|
||||
_window(NULL),
|
||||
_cull_region_pcollector("Cull:Invalid"),
|
||||
_draw_region_pcollector("Draw:Invalid")
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void DisplayRegion::
|
||||
operator = (const DisplayRegion&) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,10 +57,8 @@ class CullTraverser;
|
|||
class EXPCL_PANDA_DISPLAY DisplayRegion : public TypedReferenceCount, public DrawableRegion {
|
||||
protected:
|
||||
DisplayRegion(GraphicsOutput *window, const LVecBase4 &dimensions);
|
||||
|
||||
private:
|
||||
DisplayRegion(const DisplayRegion ©);
|
||||
void operator = (const DisplayRegion ©);
|
||||
DisplayRegion(const DisplayRegion ©) = delete;
|
||||
void operator = (const DisplayRegion ©) = delete;
|
||||
|
||||
public:
|
||||
virtual ~DisplayRegion();
|
||||
|
|
@ -310,9 +308,8 @@ private:
|
|||
class EXPCL_PANDA_DISPLAY DisplayRegionPipelineReader {
|
||||
public:
|
||||
INLINE DisplayRegionPipelineReader(DisplayRegion *object, Thread *current_thread);
|
||||
private:
|
||||
INLINE DisplayRegionPipelineReader(const DisplayRegionPipelineReader ©);
|
||||
INLINE void operator = (const DisplayRegionPipelineReader ©);
|
||||
DisplayRegionPipelineReader(const DisplayRegionPipelineReader ©) = delete;
|
||||
void operator = (const DisplayRegionPipelineReader ©) = delete;
|
||||
|
||||
public:
|
||||
INLINE ~DisplayRegionPipelineReader();
|
||||
|
|
|
|||
|
|
@ -34,22 +34,6 @@ GraphicsDevice(GraphicsPipe *pipe) {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
GraphicsDevice::
|
||||
GraphicsDevice(const GraphicsDevice &) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void GraphicsDevice::
|
||||
operator = (const GraphicsDevice &) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -30,10 +30,8 @@ class GraphicsPipe;
|
|||
class EXPCL_PANDA_DISPLAY GraphicsDevice : public TypedReferenceCount {
|
||||
public:
|
||||
GraphicsDevice(GraphicsPipe *pipe);
|
||||
|
||||
private:
|
||||
GraphicsDevice(const GraphicsDevice ©);
|
||||
void operator = (const GraphicsDevice ©);
|
||||
GraphicsDevice(const GraphicsDevice ©) = delete;
|
||||
GraphicsDevice &operator = (const GraphicsDevice ©) = delete;
|
||||
|
||||
PUBLISHED:
|
||||
virtual ~GraphicsDevice();
|
||||
|
|
|
|||
|
|
@ -1538,7 +1538,7 @@ cull_to_bins(GraphicsEngine::Windows wlist, Thread *current_thread) {
|
|||
}
|
||||
|
||||
// Save the results for next frame.
|
||||
dr->set_cull_result(MOVE(cull_result), MOVE(scene_setup), current_thread);
|
||||
dr->set_cull_result(move(cull_result), MOVE(scene_setup), current_thread);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,25 +159,6 @@ GraphicsOutput(GraphicsEngine *engine, GraphicsPipe *pipe,
|
|||
set_clear_color(background_color.get_value());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
GraphicsOutput::
|
||||
GraphicsOutput(const GraphicsOutput &) :
|
||||
_cull_window_pcollector(_cull_pcollector, "Invalid"),
|
||||
_draw_window_pcollector(_draw_pcollector, "Invalid")
|
||||
{
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void GraphicsOutput::
|
||||
operator = (const GraphicsOutput &) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -70,10 +70,8 @@ protected:
|
|||
GraphicsStateGuardian *gsg,
|
||||
GraphicsOutput *host,
|
||||
bool default_stereo_flags);
|
||||
|
||||
private:
|
||||
GraphicsOutput(const GraphicsOutput ©);
|
||||
void operator = (const GraphicsOutput ©);
|
||||
GraphicsOutput(const GraphicsOutput ©) = delete;
|
||||
GraphicsOutput &operator = (const GraphicsOutput ©) = delete;
|
||||
|
||||
PUBLISHED:
|
||||
enum RenderTextureMode {
|
||||
|
|
|
|||
|
|
@ -52,9 +52,8 @@ class DisplayInformation;
|
|||
class EXPCL_PANDA_DISPLAY GraphicsPipe : public TypedReferenceCount {
|
||||
protected:
|
||||
GraphicsPipe();
|
||||
private:
|
||||
GraphicsPipe(const GraphicsPipe ©) DELETED;
|
||||
GraphicsPipe &operator = (const GraphicsPipe ©) DELETED_ASSIGN;
|
||||
GraphicsPipe(const GraphicsPipe ©) = delete;
|
||||
GraphicsPipe &operator = (const GraphicsPipe ©) = delete;
|
||||
|
||||
PUBLISHED:
|
||||
virtual ~GraphicsPipe();
|
||||
|
|
|
|||
|
|
@ -286,7 +286,7 @@ PUBLISHED:
|
|||
MAKE_PROPERTY(driver_shader_version_minor, get_driver_shader_version_minor);
|
||||
|
||||
bool set_scene(SceneSetup *scene_setup);
|
||||
virtual SceneSetup *get_scene() const FINAL;
|
||||
virtual SceneSetup *get_scene() const final;
|
||||
MAKE_PROPERTY(scene, get_scene, set_scene);
|
||||
|
||||
public:
|
||||
|
|
|
|||
|
|
@ -122,9 +122,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
|
|||
o._owns_obj = owns_obj;
|
||||
|
||||
// Ensure that we have the mutex while we fiddle with the list of outputs.
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
_outputs.push_back(o);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -133,9 +133,9 @@ add_output(MultiplexStreamBuf::BufferType buffer_type,
|
|||
*/
|
||||
void MultiplexStreamBuf::
|
||||
flush() {
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
write_chars("", 0, true);
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -144,7 +144,7 @@ flush() {
|
|||
*/
|
||||
int MultiplexStreamBuf::
|
||||
overflow(int ch) {
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
|
||||
streamsize n = pptr() - pbase();
|
||||
|
||||
|
|
@ -159,7 +159,7 @@ overflow(int ch) {
|
|||
write_chars(&c, 1, false);
|
||||
}
|
||||
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +169,7 @@ overflow(int ch) {
|
|||
*/
|
||||
int MultiplexStreamBuf::
|
||||
sync() {
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
|
||||
streamsize n = pptr() - pbase();
|
||||
|
||||
|
|
@ -181,7 +181,7 @@ sync() {
|
|||
write_chars(pbase(), n, false);
|
||||
pbump(-n);
|
||||
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
return 0; // Return 0 for success, EOF to indicate write full.
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@ output(ostream &out) const {
|
|||
PT(HTTPChannel) VirtualFileMountHTTP::
|
||||
get_channel() {
|
||||
PT(HTTPChannel) channel;
|
||||
_channels_lock.acquire();
|
||||
_channels_lock.lock();
|
||||
|
||||
if (!_channels.empty()) {
|
||||
// If we have some channels sitting around, grab one. Grab the one on the
|
||||
|
|
@ -251,7 +251,7 @@ get_channel() {
|
|||
channel = _http->make_channel(true);
|
||||
}
|
||||
|
||||
_channels_lock.release();
|
||||
_channels_lock.unlock();
|
||||
return channel;
|
||||
}
|
||||
|
||||
|
|
@ -262,9 +262,9 @@ get_channel() {
|
|||
*/
|
||||
void VirtualFileMountHTTP::
|
||||
recycle_channel(HTTPChannel *channel) {
|
||||
_channels_lock.acquire();
|
||||
_channels_lock.lock();
|
||||
_channels.push_back(channel);
|
||||
_channels_lock.release();
|
||||
_channels_lock.unlock();
|
||||
}
|
||||
|
||||
#endif // HAVE_OPENSSL
|
||||
|
|
|
|||
|
|
@ -31,6 +31,6 @@ DXGeomMunger9(GraphicsStateGuardian *gsg, const RenderState *state) :
|
|||
}
|
||||
// Set a callback to unregister ourselves when either the Texture or the
|
||||
// TexGen object gets deleted.
|
||||
_texture.set_callback(this);
|
||||
_tex_gen.set_callback(this);
|
||||
_texture.add_callback(this);
|
||||
_tex_gen.add_callback(this);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ DXGeomMunger9::
|
|||
unref_delete(_filtered_texture);
|
||||
_reffed_filtered_texture = false;
|
||||
}
|
||||
|
||||
_texture.remove_callback(this);
|
||||
_tex_gen.remove_callback(this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -273,9 +273,9 @@ wake_task(AsyncTask *task) {
|
|||
}
|
||||
|
||||
{
|
||||
manager->_lock.release();
|
||||
manager->_lock.unlock();
|
||||
task->upon_birth(manager);
|
||||
manager->_lock.acquire();
|
||||
manager->_lock.lock();
|
||||
nassertv(task->_manager == nullptr &&
|
||||
task->_state == AsyncTask::S_inactive);
|
||||
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ INLINE ostream &operator << (ostream &out, const AsyncFuture &fut) {
|
|||
/**
|
||||
* Specific future that collects the results of several futures.
|
||||
*/
|
||||
class EXPCL_PANDA_EVENT AsyncGatheringFuture FINAL : public AsyncFuture {
|
||||
class EXPCL_PANDA_EVENT AsyncGatheringFuture final : public AsyncFuture {
|
||||
private:
|
||||
AsyncGatheringFuture(AsyncFuture::Futures futures);
|
||||
|
||||
|
|
|
|||
|
|
@ -415,7 +415,7 @@ unlock_and_do_task() {
|
|||
#endif // __GNUC__
|
||||
|
||||
// It's important to release the lock while the task is being serviced.
|
||||
_manager->_lock.release();
|
||||
_manager->_lock.unlock();
|
||||
|
||||
double start = clock->get_real_time();
|
||||
_task_pcollector.start();
|
||||
|
|
@ -424,7 +424,7 @@ unlock_and_do_task() {
|
|||
double end = clock->get_real_time();
|
||||
|
||||
// Now reacquire the lock (so we can return with the lock held).
|
||||
_manager->_lock.acquire();
|
||||
_manager->_lock.lock();
|
||||
|
||||
_dt = end - start;
|
||||
_max_dt = max(_dt, _max_dt);
|
||||
|
|
|
|||
|
|
@ -103,8 +103,8 @@ protected:
|
|||
void jump_to_task_chain(AsyncTaskManager *manager);
|
||||
DoneStatus unlock_and_do_task();
|
||||
|
||||
virtual bool cancel() FINAL;
|
||||
virtual bool is_task() const FINAL {return true;}
|
||||
virtual bool cancel() final;
|
||||
virtual bool is_task() const final {return true;}
|
||||
|
||||
virtual bool is_runnable();
|
||||
virtual DoneStatus do_task();
|
||||
|
|
|
|||
|
|
@ -596,11 +596,11 @@ do_cleanup() {
|
|||
nassertv(_num_tasks == 0 || _num_tasks == 1);
|
||||
|
||||
// Now go back and call the upon_death functions.
|
||||
_manager->_lock.release();
|
||||
_manager->_lock.unlock();
|
||||
for (ti = dead.begin(); ti != dead.end(); ++ti) {
|
||||
(*ti)->upon_death(_manager, false);
|
||||
}
|
||||
_manager->_lock.acquire();
|
||||
_manager->_lock.lock();
|
||||
|
||||
if (task_cat.is_spam()) {
|
||||
do_output(task_cat.spam());
|
||||
|
|
@ -791,9 +791,9 @@ cleanup_task(AsyncTask *task, bool upon_death, bool clean_exit) {
|
|||
task->_manager = nullptr;
|
||||
|
||||
if (upon_death) {
|
||||
_manager->_lock.release();
|
||||
_manager->_lock.unlock();
|
||||
task->upon_death(_manager, clean_exit);
|
||||
_manager->_lock.acquire();
|
||||
_manager->_lock.lock();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1031,7 +1031,7 @@ do_stop_threads() {
|
|||
|
||||
// We have to release the lock while we join, so the threads can wake up
|
||||
// and see that we're shutting down.
|
||||
_manager->_lock.release();
|
||||
_manager->_lock.unlock();
|
||||
Threads::iterator ti;
|
||||
for (ti = wait_threads.begin(); ti != wait_threads.end(); ++ti) {
|
||||
if (task_cat.is_debug()) {
|
||||
|
|
@ -1046,7 +1046,7 @@ do_stop_threads() {
|
|||
<< *Thread::get_current_thread() << "\n";
|
||||
}
|
||||
}
|
||||
_manager->_lock.acquire();
|
||||
_manager->_lock.lock();
|
||||
|
||||
_state = S_initial;
|
||||
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ add(AsyncTask *task) {
|
|||
task->_state == AsyncTask::S_inactive);
|
||||
nassertv(!do_has_task(task));
|
||||
|
||||
_lock.release();
|
||||
_lock.unlock();
|
||||
task->upon_birth(this);
|
||||
_lock.acquire();
|
||||
_lock.lock();
|
||||
nassertv(task->_manager == NULL &&
|
||||
task->_state == AsyncTask::S_inactive);
|
||||
nassertv(!do_has_task(task));
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
class EXPCL_PANDA_EVENT EventParameter {
|
||||
PUBLISHED:
|
||||
INLINE EventParameter() DEFAULT_CTOR;
|
||||
INLINE EventParameter() = default;
|
||||
INLINE EventParameter(nullptr_t) {};
|
||||
INLINE EventParameter(const TypedWritableReferenceCount *ptr);
|
||||
INLINE EventParameter(const TypedReferenceCount *ptr);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
* This class exists to allow association of a Python function or coroutine
|
||||
* with the AsyncTaskManager.
|
||||
*/
|
||||
class PythonTask FINAL : public AsyncTask {
|
||||
class PythonTask final : public AsyncTask {
|
||||
PUBLISHED:
|
||||
PythonTask(PyObject *function = Py_None, const string &name = string());
|
||||
virtual ~PythonTask();
|
||||
|
|
|
|||
|
|
@ -40,9 +40,13 @@ PUBLISHED:
|
|||
INLINE Datagram();
|
||||
INLINE Datagram(const void *data, size_t size);
|
||||
INLINE explicit Datagram(vector_uchar data);
|
||||
|
||||
Datagram(const Datagram ©) = default;
|
||||
Datagram(Datagram &&from) noexcept = default;
|
||||
virtual ~Datagram();
|
||||
|
||||
Datagram &operator = (const Datagram ©) = default;
|
||||
Datagram &operator = (Datagram &&from) noexcept = default;
|
||||
|
||||
virtual void clear();
|
||||
void dump_hex(ostream &out, unsigned int indent=0) const;
|
||||
|
||||
|
|
|
|||
|
|
@ -136,25 +136,6 @@ Multifile::
|
|||
close();
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't try to copy Multifiles.
|
||||
*/
|
||||
Multifile::
|
||||
Multifile(const Multifile ©) :
|
||||
_read_filew(_read_file),
|
||||
_read_write_filew(_read_write_file)
|
||||
{
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Don't try to copy Multifiles.
|
||||
*/
|
||||
void Multifile::
|
||||
operator = (const Multifile ©) {
|
||||
nassertv(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the named Multifile on disk for reading. The Multifile index is read
|
||||
* in, and the list of subfiles becomes available; individual subfiles may
|
||||
|
|
|
|||
|
|
@ -37,11 +37,10 @@ typedef struct evp_pkey_st EVP_PKEY;
|
|||
class EXPCL_PANDAEXPRESS Multifile : public ReferenceCount {
|
||||
PUBLISHED:
|
||||
Multifile();
|
||||
Multifile(const Multifile ©) = delete;
|
||||
~Multifile();
|
||||
|
||||
private:
|
||||
Multifile(const Multifile ©);
|
||||
void operator = (const Multifile ©);
|
||||
Multifile &operator = (const Multifile ©) = delete;
|
||||
|
||||
PUBLISHED:
|
||||
BLOCKING bool open_read(const Filename &multifile_name, const streampos &offset = 0);
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue