Exemplo n.º 1
0
    def __init__(self, request, client_address):
        self.request = request
        self.client_address = client_address

        self.account_mgr = None
        self.player_mgr: Optional[PlayerManager] = None
        self.keep_alive = False

        self.incoming_pending = _queue.SimpleQueue()
        self.outgoing_pending = _queue.SimpleQueue()
Exemplo n.º 2
0
import traceback
import _queue
from database.dbc.DbcDatabaseManager import DbcDatabaseManager
from game.world.managers.maps.Constants import SIZE, RESOLUTION_ZMAP, RESOLUTION_AREA_INFO, RESOLUTION_LIQUIDS
from game.world.managers.maps.Map import Map
from game.world.managers.maps.MapTile import MapTile
from utils.ConfigManager import config
from utils.Logger import Logger

MAPS = {}
MAP_LIST = DbcDatabaseManager.map_get_all_ids()
AREAS = {}
AREA_LIST = DbcDatabaseManager.area_get_all_ids()
PENDING_LOAD = {}
PENDING_LOAD_QUEUE = _queue.SimpleQueue()


# noinspection PyBroadException
class MapManager(object):
    @staticmethod
    def initialize_maps():
        for map_id in MAP_LIST:
            MAPS[map_id] = Map(map_id, MapManager.on_cell_turn_active)

    @staticmethod
    def initialize_area_tables():
        for area_id in AREA_LIST:
            AREAS[area_id] = DbcDatabaseManager.area_get_by_id(area_id)

    @staticmethod
    def get_area_number_by_zone_id(zone_id):
Exemplo n.º 3
0
import _queue

#创建基本队列
Q = _queue.SimpleQueue()
print(Q)
Exemplo n.º 4
0
def test():
    assert (_weakref.ReferenceType is _weakref.ref)
    for _ in range(99):
        time.sleep(5)  # Throttle to avoid a MemoryError

        try:
            _weakref._remove_dead_weakref(dct, 'obj')
        except NameError:
            pass

        obj = fclass()
        _weakref.getweakrefcount
        dct = {'obj': _weakref.ref(obj)}
        _weakref.getweakrefs(obj)
        _weakref.getweakrefs(dct['obj'])
        dct['prox'] = _weakref.proxy(ffunc, ffunc)
        dct['oprox'] = _weakref.proxy(obj, ffunc)

        q = _queue.SimpleQueue()

        lock = rnd.choice([_thread.allocate_lock, _thread.allocate])()

        def lock_thread(*a, **k):
            try:
                rnd.choice([lock.acquire_lock,
                            lock.acquire])(blocking=fbool(),
                                           timeout=rnd.randint(-10, 10))
            except ValueError:
                pass
            rnd.choice([lock.locked, lock.locked_lock])()
            ffunc(q)
            try:
                rnd.choice([lock.release_lock, lock.release])()
            except RuntimeError:
                pass
            try:
                with lock:
                    ffunc(q)
            except RuntimeError:
                pass
            rnd.choice([lock.locked, lock.locked_lock])()
            l = _thread._set_sentinel()
            if fbool(): rnd.choice([_thread.exit_thread, _thread.exit])()

        rlock = _thread.RLock()

        def rlock_thread(*a, **k):
            rlock.acquire(fbool())
            ffunc(q)
            rlock._is_owned()
            if fbool():
                try:
                    rlock._release_save()
                except RuntimeError:
                    pass
            if fbool():
                rlock._acquire_restore(
                    (rnd.randint(-9999, 9999), rnd.randint(-9999, 9999)))
            try:
                rlock.release()
            except RuntimeError:
                pass
            try:
                with rlock:
                    ffunc(q)
            except RuntimeError:
                pass
            rlock._is_owned()
            if fbool(): rnd.choice([_thread.exit_thread, _thread.exit])()

        for _ in range(99):
            repr(lock)
            repr(rlock)

            try:
                rnd.choice([_thread.start_new, _thread.start_new_thread
                            ])(rnd.choice([lock_thread, rlock_thread]),
                               (q, ) + ftup(), fdict())
            except RuntimeError:
                pass

            try:
                _thread.stack_size(rnd.randint(-99999999, 99999999))
            except (ValueError, OverflowError):
                pass

            ffunc(q)

            try:
                _thread.interrupt_main()
            except KeyboardInterrupt:
                pass