Permalink
Browse files

Merge branch 'master' into deploy-ng

  • Loading branch information...
rdb committed Sep 4, 2017
2 parents dcef0c3 + 82eec03 commit f16cd299710796b5cece7ffc1d434936e26f8bc5
Showing with 4,787 additions and 3,962 deletions.
  1. +35 −11 direct/src/stdpy/thread.py
  2. +33 −11 direct/src/stdpy/threading.py
  3. +43 −26 direct/src/stdpy/threading2.py
  4. +2,245 −2,227 dtool/src/cppparser/cppBison.cxx.prebuilt
  5. +4 −0 dtool/src/cppparser/cppBison.yxx
  6. +1 −1 dtool/src/dtoolbase/dtoolbase.h
  7. +4 −8 dtool/src/dtoolbase/dtoolbase_cc.h
  8. +11 −16 dtool/src/dtoolbase/memoryHook.cxx
  9. +1 −3 dtool/src/dtoolbase/memoryHook.h
  10. +0 −2 dtool/src/dtoolbase/typeRegistryNode.cxx
  11. +0 −2 dtool/src/dtoolbase/typeRegistryNode.h
  12. +16 −0 dtool/src/dtoolutil/executionEnvironment.cxx
  13. +5 −0 dtool/src/dtoolutil/executionEnvironment.h
  14. +11 −4 dtool/src/dtoolutil/filename.cxx
  15. +5 −5 dtool/src/dtoolutil/load_dso.cxx
  16. +15 −0 dtool/src/dtoolutil/pandaSystem.h
  17. +1 −0 dtool/src/dtoolutil/textEncoder.h
  18. +2 −1 dtool/src/interrogate/interfaceMaker.cxx
  19. +1 −0 dtool/src/interrogate/interfaceMaker.h
  20. +127 −41 dtool/src/interrogate/interfaceMakerPythonNative.cxx
  21. +138 −3 dtool/src/interrogatedb/py_panda.cxx
  22. +3 −0 dtool/src/interrogatedb/py_panda.h
  23. +4 −0 dtool/src/pystub/pystub.cxx
  24. +1 −1 makepanda/config.in
  25. +23 −6 makepanda/makepanda.py
  26. +12 −0 makepanda/makepandacore.py
  27. +2 −2 panda/src/audio/audioManager.cxx
  28. +3 −2 panda/src/audio/audioManager.h
  29. +2 −2 panda/src/audiotraits/fmodAudioManager.cxx
  30. +2 −2 panda/src/audiotraits/fmodAudioManager.h
  31. +4 −4 panda/src/bullet/bulletHeightfieldShape.I
  32. +5 −5 panda/src/bullet/bulletHeightfieldShape.cxx
  33. +1 −1 panda/src/bullet/bulletHeightfieldShape.h
  34. +31 −7 panda/src/bullet/bulletTriangleMesh.cxx
  35. +15 −1 panda/src/cocoadisplay/cocoaGraphicsWindow.mm
  36. +1 −0 panda/src/collide/collisionNode.h
  37. +1 −1 panda/src/cull/cullBinBackToFront.cxx
  38. +1 −1 panda/src/cull/cullBinFixed.cxx
  39. +1 −1 panda/src/cull/cullBinFrontToBack.cxx
  40. +1 −1 panda/src/cull/cullBinStateSorted.cxx
  41. +1 −1 panda/src/cull/cullBinUnsorted.cxx
  42. +6 −2 panda/src/display/frameBufferProperties.cxx
  43. +87 −7 panda/src/display/graphicsStateGuardian.cxx
  44. +1 −3 panda/src/display/graphicsStateGuardian.h
  45. +6 −5 panda/src/display/standardMunger.cxx
  46. +2 −0 panda/src/display/windowProperties.h
  47. +1 −3 panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx
  48. +0 −1 panda/src/dxgsg9/dxGraphicsStateGuardian9.h
  49. +5 −5 panda/src/egg/eggLine.h
  50. +4 −4 panda/src/egg/eggNurbsCurve.h
  51. +5 −5 panda/src/egg/eggNurbsSurface.h
  52. +4 −4 panda/src/egg/eggPatch.h
  53. +5 −5 panda/src/egg/eggPoint.h
  54. +5 −5 panda/src/egg/eggPolygon.h
  55. +7 −7 panda/src/egg/eggTriangleFan.h
  56. +6 −6 panda/src/egg/eggTriangleStrip.h
  57. +3 −0 panda/src/express/memoryInfo.h
  58. +100 −4 panda/src/express/memoryUsage.I
  59. +157 −23 panda/src/express/memoryUsage.cxx
  60. +25 −10 panda/src/express/memoryUsage.h
  61. +6 −5 panda/src/express/memoryUsagePointerCounts.cxx
  62. +0 −4 panda/src/express/memoryUsagePointerCounts.h
  63. +33 −11 panda/src/express/memoryUsagePointers.cxx
  64. +2 −5 panda/src/express/memoryUsagePointers.h
  65. +1 −0 panda/src/express/multifile.h
  66. +98 −0 panda/src/express/ordered_vector.I
  67. +12 −0 panda/src/express/ordered_vector.h
  68. +2 −2 panda/src/express/pointerTo.h
  69. +2 −3 panda/src/express/pointerToBase.I
  70. +1 −3 panda/src/express/pointerToBase.h
  71. +2 −3 panda/src/express/threadSafePointerToBase.I
  72. +0 −2 panda/src/express/threadSafePointerToBase.h
  73. +9 −0 panda/src/express/virtualFileSimple.cxx
  74. +18 −0 panda/src/express/virtualFileSystem.cxx
  75. +0 −34 panda/src/glstuff/glCgShaderContext_src.I
  76. +14 −0 panda/src/glstuff/glCgShaderContext_src.cxx
  77. +13 −13 panda/src/glstuff/glCgShaderContext_src.h
  78. +4 −5 panda/src/glstuff/glGraphicsStateGuardian_src.cxx
  79. +0 −1 panda/src/glstuff/glGraphicsStateGuardian_src.h
  80. +0 −35 panda/src/glstuff/glShaderContext_src.I
  81. +19 −5 panda/src/glstuff/glShaderContext_src.cxx
  82. +19 −15 panda/src/glstuff/glShaderContext_src.h
  83. +6 −6 panda/src/gobj/geom.cxx
  84. +1 −2 panda/src/gobj/geom.h
  85. +0 −2 panda/src/gobj/internalName.h
  86. +8 −0 panda/src/gobj/material.I
  87. +2 −2 panda/src/gobj/material.h
  88. +109 −8 panda/src/gobj/shader.cxx
  89. +11 −0 panda/src/gobj/shader.h
  90. +2 −0 panda/src/gobj/textureStage.h
  91. +1 −0 panda/src/gobj/textureStagePool.h
  92. +1 −0 panda/src/gobj/vertexDataPage.h
  93. +0 −1 panda/src/gsgbase/graphicsStateGuardianBase.h
  94. +0 −2 panda/src/mathutil/geometricBoundingVolume.h
  95. +17 −0 panda/src/parametrics/ropeNode.h
  96. +0 −16 panda/src/pgraph/alphaTestAttrib.cxx
  97. +1 −1 panda/src/pgraph/alphaTestAttrib.h
  98. +1 −0 panda/src/pgraph/antialiasAttrib.h
  99. +1 −0 panda/src/pgraph/audioVolumeAttrib.h
  100. +0 −8 panda/src/pgraph/auxBitplaneAttrib.cxx
  101. +1 −1 panda/src/pgraph/auxBitplaneAttrib.h
  102. +0 −8 panda/src/pgraph/clipPlaneAttrib.cxx
  103. +1 −1 panda/src/pgraph/clipPlaneAttrib.h
  104. +0 −13 panda/src/pgraph/colorAttrib.cxx
  105. +1 −1 panda/src/pgraph/colorAttrib.h
  106. +0 −8 panda/src/pgraph/colorBlendAttrib.cxx
  107. +1 −1 panda/src/pgraph/colorBlendAttrib.h
  108. +0 −11 panda/src/pgraph/colorScaleAttrib.cxx
  109. +1 −1 panda/src/pgraph/colorScaleAttrib.h
  110. +1 −0 panda/src/pgraph/colorWriteAttrib.h
  111. +1 −0 panda/src/pgraph/cullBinAttrib.h
  112. +1 −0 panda/src/pgraph/cullFaceAttrib.h
  113. +0 −2 panda/src/pgraph/cullPlanes.h
  114. +4 −6 panda/src/pgraph/cullableObject.I
  115. +12 −10 panda/src/pgraph/cullableObject.cxx
  116. +5 −17 panda/src/pgraph/cullableObject.h
  117. +1 −0 panda/src/pgraph/depthOffsetAttrib.h
  118. +1 −0 panda/src/pgraph/depthTestAttrib.h
  119. +1 −0 panda/src/pgraph/depthWriteAttrib.h
  120. +0 −8 panda/src/pgraph/fogAttrib.cxx
  121. +1 −1 panda/src/pgraph/fogAttrib.h
  122. +2 −2 panda/src/pgraph/geomDrawCallbackData.cxx
  123. +1 −0 panda/src/pgraph/geomNode.h
  124. +14 −0 panda/src/pgraph/light.cxx
  125. +3 −0 panda/src/pgraph/light.h
  126. +0 −13 panda/src/pgraph/lightAttrib.I
  127. +67 −15 panda/src/pgraph/lightAttrib.cxx
  128. +3 −2 panda/src/pgraph/lightAttrib.h
  129. +0 −8 panda/src/pgraph/lightRampAttrib.cxx
  130. +1 −1 panda/src/pgraph/lightRampAttrib.h
  131. +0 −8 panda/src/pgraph/logicOpAttrib.cxx
  132. +1 −1 panda/src/pgraph/logicOpAttrib.h
  133. +2 −10 panda/src/pgraph/materialAttrib.I
  134. +3 −54 panda/src/pgraph/materialAttrib.cxx
  135. +1 −5 panda/src/pgraph/materialAttrib.h
  136. +0 −2 panda/src/pgraph/nodePathComponent.h
  137. +2 −2 panda/src/pgraph/pandaNode.h
  138. +0 −19 panda/src/pgraph/renderAttrib.I
  139. +1 −9 panda/src/pgraph/renderAttrib.cxx
  140. +1 −2 panda/src/pgraph/renderAttrib.h
  141. +1 −0 panda/src/pgraph/renderModeAttrib.h
  142. +1 −85 panda/src/pgraph/renderState.cxx
  143. +0 −8 panda/src/pgraph/renderState.h
  144. +0 −16 panda/src/pgraph/rescaleNormalAttrib.cxx
  145. +1 −1 panda/src/pgraph/rescaleNormalAttrib.h
  146. +1 −0 panda/src/pgraph/scissorAttrib.h
  147. +1 −0 panda/src/pgraph/shadeModelAttrib.h
  148. +0 −20 panda/src/pgraph/shaderAttrib.cxx
  149. +1 −1 panda/src/pgraph/shaderAttrib.h
  150. +1 −0 panda/src/pgraph/stencilAttrib.h
  151. +0 −8 panda/src/pgraph/texGenAttrib.cxx
  152. +1 −1 panda/src/pgraph/texGenAttrib.h
  153. +0 −22 panda/src/pgraph/texMatrixAttrib.cxx
  154. +1 −1 panda/src/pgraph/texMatrixAttrib.h
  155. +1 −41 panda/src/pgraph/textureAttrib.I
  156. +2 −78 panda/src/pgraph/textureAttrib.cxx
  157. +1 −9 panda/src/pgraph/textureAttrib.h
  158. +1 −1 panda/src/pgraph/transformState.cxx
  159. +0 −2 panda/src/pgraph/transformState.h
  160. +0 −15 panda/src/pgraph/transparencyAttrib.cxx
  161. +1 −1 panda/src/pgraph/transparencyAttrib.h
  162. +1 −4 panda/src/pgraphnodes/directionalLight.cxx
  163. +0 −2 panda/src/pgraphnodes/directionalLight.h
  164. +9 −0 panda/src/pgraphnodes/lightLensNode.I
  165. +32 −2 panda/src/pgraphnodes/lightLensNode.cxx
  166. +11 −0 panda/src/pgraphnodes/lightLensNode.h
  167. +1 −4 panda/src/pgraphnodes/pointLight.cxx
  168. +0 −2 panda/src/pgraphnodes/pointLight.h
  169. +793 −599 panda/src/pgraphnodes/shaderGenerator.cxx
  170. +72 −58 panda/src/pgraphnodes/shaderGenerator.h
  171. +1 −4 panda/src/pgraphnodes/spotlight.cxx
  172. +0 −2 panda/src/pgraphnodes/spotlight.h
  173. +1 −0 panda/src/pgui/pgButton.h
  174. +10 −0 panda/src/pipeline/thread.h
  175. +17 −17 panda/src/pnmimage/pnmImage.h
  176. +10 −2 panda/src/pnmimagetypes/config_pnmimagetypes.cxx
  177. +1 −0 panda/src/pnmimagetypes/config_pnmimagetypes.h
  178. +4 −0 panda/src/pnmimagetypes/pnmFileTypePNG.cxx
  179. +1 −1 panda/src/pstatclient/pStatProperties.cxx
  180. +0 −2 panda/src/putil/copyOnWriteObject.h
  181. +1 −2 panda/src/putil/typedWritableReferenceCount.h
  182. +3 −0 panda/src/speedtree/speedTreeNode.h
  183. +1 −2 panda/src/tinydisplay/tinyGraphicsStateGuardian.cxx
  184. +0 −1 panda/src/tinydisplay/tinyGraphicsStateGuardian.h
  185. +1 −0 panda/src/vision/webcamVideo.h
  186. +10 −14 panda/src/x11display/x11GraphicsWindow.cxx
View
@@ -11,18 +11,32 @@
'interrupt_main',
'exit', 'allocate_lock', 'get_ident',
'stack_size',
'force_yield', 'consider_yield',
'forceYield', 'considerYield',
'TIMEOUT_MAX'
]
from panda3d import core
import sys
if sys.platform == "win32":
TIMEOUT_MAX = float(0xffffffff // 1000)
else:
TIMEOUT_MAX = float(0x7fffffffffffffff // 1000000000)
# These methods are defined in Panda, and are particularly useful if
# you may be running in Panda's SIMPLE_THREADS compilation mode.
forceYield = core.Thread.forceYield
considerYield = core.Thread.considerYield
force_yield = core.Thread.force_yield
consider_yield = core.Thread.consider_yield
class error(Exception):
pass
forceYield = force_yield
considerYield = consider_yield
if sys.version_info >= (3, 3):
error = RuntimeError
else:
class error(Exception):
pass
class LockType:
""" Implements a mutex lock. Instead of directly subclassing
@@ -36,13 +50,18 @@ def __init__(self):
self.__cvar = core.ConditionVar(self.__lock)
self.__locked = False
def acquire(self, waitflag = 1):
def acquire(self, waitflag = 1, timeout = -1):
self.__lock.acquire()
try:
if self.__locked and not waitflag:
return False
while self.__locked:
self.__cvar.wait()
if timeout >= 0:
while self.__locked:
self.__cvar.wait(timeout)
else:
while self.__locked:
self.__cvar.wait()
self.__locked = True
return True
@@ -202,12 +221,17 @@ def _get_thread_locals(thread, i):
def _remove_thread_id(threadId):
""" Removes the thread with the indicated ID from the thread list. """
# On interpreter shutdown, Python may set module globals to None.
if _threadsLock is None or _threads is None:
return
_threadsLock.acquire()
try:
thread, locals, wrapper = _threads[threadId]
assert thread.getPythonIndex() == threadId
del _threads[threadId]
thread.setPythonIndex(-1)
if threadId in _threads:
thread, locals, wrapper = _threads[threadId]
assert thread.getPythonIndex() == threadId
del _threads[threadId]
thread.setPythonIndex(-1)
finally:
_threadsLock.release()
@@ -35,11 +35,15 @@
'Event',
'Timer',
'local',
'current_thread', 'currentThread',
'enumerate', 'active_count', 'activeCount',
'current_thread',
'main_thread',
'enumerate', 'active_count',
'settrace', 'setprofile', 'stack_size',
'TIMEOUT_MAX',
]
TIMEOUT_MAX = _thread.TIMEOUT_MAX
local = _thread._local
_newname = _thread._newname
@@ -98,7 +102,15 @@ def __init__(self, group=None, target=None, name=None, args=(), kwargs={}):
self.__dict__['daemon'] = current.daemon
self.__dict__['name'] = name
self.__thread = core.PythonThread(self.run, None, name, name)
def call_run():
# As soon as the thread is done, break the circular reference.
try:
self.run()
finally:
self.__thread = None
_thread._remove_thread_id(self.ident)
self.__thread = core.PythonThread(call_run, None, name, name)
threadId = _thread._add_thread(self.__thread, weakref.proxy(self))
self.__dict__['ident'] = threadId
@@ -109,16 +121,17 @@ def __del__(self):
_thread._remove_thread_id(self.ident)
def is_alive(self):
return self.__thread.isStarted()
thread = self.__thread
return thread is not None and thread.is_started()
def isAlive(self):
return self.__thread.isStarted()
isAlive = is_alive
def start(self):
if self.__thread.isStarted():
thread = self.__thread
if thread is None or thread.is_started():
raise RuntimeError
if not self.__thread.start(core.TPNormal, True):
if not thread.start(core.TPNormal, True):
raise RuntimeError
def run(self):
@@ -132,8 +145,12 @@ def run(self):
def join(self, timeout = None):
# We don't support a timed join here, sorry.
assert timeout is None
self.__thread.join()
self.__thread = None
thread = self.__thread
if thread is not None:
thread.join()
# Clear the circular reference.
self.__thread = None
_thread._remove_thread_id(self.ident)
def setName(self, name):
self.__dict__['name'] = name
@@ -379,21 +396,26 @@ def current_thread():
t = core.Thread.getCurrentThread()
return _thread._get_thread_wrapper(t, _create_thread_wrapper)
def main_thread():
t = core.Thread.getMainThread()
return _thread._get_thread_wrapper(t, _create_thread_wrapper)
currentThread = current_thread
def enumerate():
tlist = []
_thread._threadsLock.acquire()
try:
for thread, locals, wrapper in list(_thread._threads.values()):
if wrapper and thread.isStarted():
if wrapper and wrapper.is_alive():
tlist.append(wrapper)
return tlist
finally:
_thread._threadsLock.release()
def active_count():
return len(enumerate())
activeCount = active_count
_settrace_func = None
@@ -15,24 +15,27 @@
import sys as _sys
from direct.stdpy import thread
from direct.stdpy import thread as _thread
from direct.stdpy.thread import stack_size, _newname, _local as local
from panda3d import core
_sleep = core.Thread.sleep
from time import time as _time
from traceback import format_exc as _format_exc
# Rename some stuff so "from threading import *" is safe
__all__ = ['activeCount', 'Condition', 'currentThread', 'enumerate', 'Event',
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
'Timer', 'setprofile', 'settrace', 'local', 'stack_size']
__all__ = ['get_ident', 'active_count', 'Condition', 'current_thread',
'enumerate', 'main_thread', 'TIMEOUT_MAX',
'Event', 'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Thread',
'Timer', 'ThreadError',
'setprofile', 'settrace', 'local', 'stack_size']
_start_new_thread = thread.start_new_thread
_allocate_lock = thread.allocate_lock
_get_ident = thread.get_ident
ThreadError = thread.error
del thread
# Rename some stuff so "from threading import *" is safe
_start_new_thread = _thread.start_new_thread
_allocate_lock = _thread.allocate_lock
get_ident = _thread.get_ident
ThreadError = _thread.error
TIMEOUT_MAX = _thread.TIMEOUT_MAX
del _thread
# Debug support (adapted from ihooks.py).
@@ -446,7 +449,7 @@ def __bootstrap(self):
try:
self.__started = True
_active_limbo_lock.acquire()
_active[_get_ident()] = self
_active[get_ident()] = self
del _limbo[self]
_active_limbo_lock.release()
if __debug__:
@@ -537,7 +540,7 @@ def __delete(self):
_active_limbo_lock.acquire()
try:
try:
del _active[_get_ident()]
del _active[get_ident()]
except KeyError:
if 'dummy_threading' not in _sys.modules:
raise
@@ -581,10 +584,12 @@ def setName(self, name):
assert self.__initialized, "Thread.__init__() not called"
self.__name = str(name)
def isAlive(self):
def is_alive(self):
assert self.__initialized, "Thread.__init__() not called"
return self.__started and not self.__stopped
isAlive = is_alive
def isDaemon(self):
assert self.__initialized, "Thread.__init__() not called"
return self.__daemonic
@@ -634,7 +639,7 @@ def __init__(self):
Thread.__init__(self, name="MainThread")
self._Thread__started = True
_active_limbo_lock.acquire()
_active[_get_ident()] = self
_active[get_ident()] = self
_active_limbo_lock.release()
def _set_daemon(self):
@@ -653,12 +658,6 @@ def _exitfunc(self):
self._note("%s: exiting", self)
self._Thread__delete()
def _pickSomeNonDaemonThread():
for t in enumerate():
if not t.isDaemon() and t.isAlive():
return t
return None
# Dummy thread class to represent threads not started here.
# These aren't garbage collected when they die, nor can they be waited for.
@@ -680,7 +679,7 @@ def __init__(self):
self._Thread__started = True
_active_limbo_lock.acquire()
_active[_get_ident()] = self
_active[get_ident()] = self
_active_limbo_lock.release()
def _set_daemon(self):
@@ -692,19 +691,23 @@ def join(self, timeout=None):
# Global API functions
def currentThread():
def current_thread():
try:
return _active[_get_ident()]
return _active[get_ident()]
except KeyError:
##print "currentThread(): no current thread for", _get_ident()
##print "current_thread(): no current thread for", get_ident()
return _DummyThread()
def activeCount():
currentThread = current_thread
def active_count():
_active_limbo_lock.acquire()
count = len(_active) + len(_limbo)
_active_limbo_lock.release()
return count
activeCount = active_count
def enumerate():
_active_limbo_lock.acquire()
active = list(_active.values()) + list(_limbo.values())
@@ -717,7 +720,21 @@ def enumerate():
# and make it available for the interpreter
# (Py_Main) as threading._shutdown.
_shutdown = _MainThread()._exitfunc
_main_thread = _MainThread()
_shutdown = _main_thread._exitfunc
def _pickSomeNonDaemonThread():
for t in enumerate():
if not t.isDaemon() and t.isAlive():
return t
return None
def main_thread():
"""Return the main thread object.
In normal conditions, the main thread is the thread from which the
Python interpreter was started.
"""
return _main_thread
# get thread-local implementation, either from the thread
# module, or from the python fallback
Oops, something went wrong.

0 comments on commit f16cd29

Please sign in to comment.