當前位置: 首頁>>代碼示例>>Python>>正文


Python stackless.getcurrent方法代碼示例

本文整理匯總了Python中stackless.getcurrent方法的典型用法代碼示例。如果您正苦於以下問題:Python stackless.getcurrent方法的具體用法?Python stackless.getcurrent怎麽用?Python stackless.getcurrent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在stackless的用法示例。


在下文中一共展示了stackless.getcurrent方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: get_id

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def get_id():
            return greenlet.getcurrent(), stackless.getcurrent() 
開發者ID:pylover,項目名稱:sqlalchemy-media,代碼行數:4,代碼來源:context.py

示例2: _stackless_schedule_cb

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def _stackless_schedule_cb(self, prev, next):
        current = stackless.getcurrent()
        if not current:
            return
        current_tf = current.trace_function
        
        try:
            current.trace_function = None
            self.stepping = STEPPING_NONE
            
            # If the current frame has no trace function, we may need to get it
            # from the previous frame, depending on how we ended up in the
            # callback.
            if current_tf is None:
                f_back = current.frame.f_back
                if f_back is not None:
                    current_tf = f_back.f_trace

            if next is not None:
                # Assign our trace function to the current stack
                f = next.frame
                if next is current:
                    f = f.f_back
                while f:
                    if isinstance(f, types.FrameType):
                        f.f_trace = self.trace_func
                    f = f.f_back
                next.trace_function = self.trace_func
        finally:
            current.trace_function = current_tf 
開發者ID:DonJayamanne,項目名稱:pythonVSCode,代碼行數:32,代碼來源:visualstudio_py_debugger.py

示例3: getcurrent

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def getcurrent():
    return tasklet_to_greenlet[stackless.getcurrent()] 
開發者ID:htwenning,項目名稱:remoteControlPPT,代碼行數:4,代碼來源:stacklesss.py

示例4: __init__

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def __init__(self, run=None, parent=None):
        self.dead = False
        if parent is None:
            parent = getcurrent()

        self.parent = parent
        if run is not None:
            self.run = run

        self.switch = FirstSwitch(self) 
開發者ID:htwenning,項目名稱:remoteControlPPT,代碼行數:12,代碼來源:stacklesss.py

示例5: switch

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def switch(self, *args):
        # print("switch", args)
        global caller
        caller = stackless.getcurrent()
        coro_args[self] = args
        self.t.insert()
        stackless.schedule()
        if caller is not self.t:
            caller.remove()
        rval = coro_args[self]
        return rval 
開發者ID:htwenning,項目名稱:remoteControlPPT,代碼行數:13,代碼來源:stacklesss.py

示例6: emulate

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def emulate():
    module = types.ModuleType('greenlet')
    sys.modules['greenlet'] = module
    module.greenlet = greenlet
    module.getcurrent = getcurrent
    module.GreenletExit = GreenletExit

    caller = stackless.getcurrent()
    tasklet_to_greenlet[caller] = None
    main_coro = greenlet()
    tasklet_to_greenlet[caller] = main_coro
    main_coro.t = caller
    del main_coro.switch  # It's already running
    coro_args[main_coro] = None 
開發者ID:htwenning,項目名稱:remoteControlPPT,代碼行數:16,代碼來源:stacklesss.py

示例7: __AddMessage

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def __AddMessage(self,char,system): #????
        old=stackless.getcurrent().set_atomic(True)
        try:
            if system not in self.__cachemsgs:
                self.__cachemsgs[system]=[]
            self.__cachemsgs[system].append(char)
        finally:
            stackless.getcurrent().set_atomic(old) 
開發者ID:EVEModX,項目名稱:Mods,代碼行數:10,代碼來源:AutoAlert.py

示例8: __SendMessage

# 需要導入模塊: import stackless [as 別名]
# 或者: from stackless import getcurrent [as 別名]
def __SendMessage(self): #????
        old=stackless.getcurrent().set_atomic(True)
        try:
            for key in self.__cachemsgs:
                msg=""
                if len(self.__cachemsgs[key]) > self.__MAX_NAME_PER_SYSTEM:
                    msg=key+" "+str(len(self.__cachemsgs[key]))+" hostile(s)"
                else:
                    msg=key
                    for name in self.__cachemsgs[key]:
                        msg+=" "+name
                sm.GetService('LSC').SendMessage(self.__alertchannel, msg)  # ??????
                sm.GetService('LSC').GetChannelWindow(self.__alertchannel).Speak(msg, eve.session.charid,localEcho=True)
        finally:
            stackless.getcurrent().set_atomic(old) 
開發者ID:EVEModX,項目名稱:Mods,代碼行數:17,代碼來源:AutoAlert.py


注:本文中的stackless.getcurrent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。