disable Toontown's cheesy lock for normal, threaded Panda

This commit is contained in:
David Rose 2012-01-06 00:51:54 +00:00
parent 211df4b90f
commit ea05496d09

View File

@ -7,15 +7,20 @@ from PythonUtil import *
from direct.directnotify import DirectNotifyGlobal
import types
# This one line will replace the cheesy hack below, when we remove the
# hack.
#from direct.stdpy.threading import Lock
from libpandaexpress import ConfigVariableBool
class Lock:
# If using the Toontown ActiveX launcher, this must be set true.
# Also, Panda must be compiled with SIMPLE_THREADS or no HAVE_THREADS
# at all. In the normal Panda case, this should be set false.
if ConfigVariableBool('delay-messenger-lock', False).getValue():
class Lock:
""" This is a cheesy delayed implementation of Lock, designed to
support the Toontown ActiveX launch, which must import Messenger
before it has downloaded the rest of Panda. This is a TEMPORARY
HACK, to be removed when the ActiveX launch is retired. """
before it has downloaded the rest of Panda. Note that this
cheesy lock isn't thread-safe if the application starts any
threads before acquiring the Messenger lock the first time.
(However, it's mostly thread-safe if Panda is compiled with
SIMPLE_THREADS.) """
notify = DirectNotifyGlobal.directNotify.newCategory("Messenger.Lock")
@ -69,7 +74,11 @@ class Lock:
self.notify.info("Got cheesy lock.")
# We return with the lock acquired.
else:
# In the normal case, there's no reason not to import all of
# libpanda right away, and so we can just use Lock directly. This
# is perfectly thread-safe.
from direct.stdpy.threading import Lock
class Messenger: