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


Python dummy_threading.Lock方法代碼示例

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


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

示例1: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, maxsize=0):
        self.maxsize = maxsize
        self._init(maxsize)
        # mutex must be held whenever the queue is mutating.  All methods
        # that acquire mutex must release it before returning.  mutex
        # is shared between the three conditions, so acquiring and
        # releasing the conditions also acquires and releases mutex.
        self.mutex = _threading.Lock()
        # Notify not_empty whenever an item is added to the queue; a
        # thread waiting to get is notified then.
        self.not_empty = _threading.Condition(self.mutex)
        # Notify not_full whenever an item is removed from the queue;
        # a thread waiting to put is notified then.
        self.not_full = _threading.Condition(self.mutex)
        # Notify all_tasks_done whenever the number of unfinished tasks
        # drops to zero; thread waiting to join() is notified to resume
        self.all_tasks_done = _threading.Condition(self.mutex)
        self.unfinished_tasks = 0 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:20,代碼來源:queue.py

示例2: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, maxsize=0):
        self.maxsize = maxsize
        self._init(maxsize)

        # mutex must be held whenever the queue is mutating.  All methods
        # that acquire mutex must release it before returning.  mutex
        # is shared between the three conditions, so acquiring and
        # releasing the conditions also acquires and releases mutex.
        self.mutex = threading.Lock()

        # Notify not_empty whenever an item is added to the queue; a
        # thread waiting to get is notified then.
        self.not_empty = threading.Condition(self.mutex)

        # Notify not_full whenever an item is removed from the queue;
        # a thread waiting to put is notified then.
        self.not_full = threading.Condition(self.mutex)

        # Notify all_tasks_done whenever the number of unfinished tasks
        # drops to zero; thread waiting to join() is notified to resume
        self.all_tasks_done = threading.Condition(self.mutex)
        self.unfinished_tasks = 0 
開發者ID:war-and-code,項目名稱:jawfish,代碼行數:24,代碼來源:queue.py

示例3: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, viz):
        """!
        Initializer function.

        @param self: class object.
        @param viz: class object.
        @return none
        """
        super(SimulationThread, self).__init__()
        assert isinstance(viz, Visualizer)
        self.viz = viz # Visualizer object
        self.lock = threading.Lock()
        self.go = threading.Event()
        self.go.clear()
        self.target_time = 0 # in seconds
        self.quit = False
        self.sim_helper = ns.visualizer.PyViz()
        self.pause_messages = [] 
開發者ID:KTH,項目名稱:royal-chaos,代碼行數:20,代碼來源:core.py

示例4: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, seed=None):
        self.pool_index = 0
        self.digest = None
        self.next_byte = 0
        self.lock = _threading.Lock()
        try:
            import hashlib
            self.hash = hashlib.sha1()
            self.hash_len = 20
        except:
            try:
                import sha
                self.hash = sha.new()
                self.hash_len = 20
            except:
                import md5
                self.hash = md5.new()
                self.hash_len = 16
        self.pool = '\0' * self.hash_len
        if not seed is None:
            self.stir(seed)
            self.seeded = True
        else:
            self.seeded = False 
開發者ID:blackye,項目名稱:luscan-devel,代碼行數:26,代碼來源:entropy.py

示例5: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, maxsize=0):
        try:
            import threading
        except ImportError:
            import dummy_threading as threading
        self._init(maxsize)
        # mutex must be held whenever the queue is mutating.  All methods
        # that acquire mutex must release it before returning.  mutex
        # is shared between the three conditions, so acquiring and
        # releasing the conditions also acquires and releases mutex.
        self.mutex = threading.Lock()
        # Notify not_empty whenever an item is added to the queue; a
        # thread waiting to get is notified then.
        self.not_empty = threading.Condition(self.mutex)
        # Notify not_full whenever an item is removed from the queue;
        # a thread waiting to put is notified then.
        self.not_full = threading.Condition(self.mutex)
        # Notify all_tasks_done whenever the number of unfinished tasks
        # drops to zero; thread waiting to join() is notified to resume
        self.all_tasks_done = threading.Condition(self.mutex)
        self.unfinished_tasks = 0 
開發者ID:ofermend,項目名稱:medicare-demo,代碼行數:23,代碼來源:Queue.py

示例6: __init__

# 需要導入模塊: import dummy_threading [as 別名]
# 或者: from dummy_threading import Lock [as 別名]
def __init__(self, seed=None):
        self.pool_index = 0
        self.digest = None
        self.next_byte = 0
        self.lock = _threading.Lock()
        try:
            import hashlib
            self.hash = hashlib.sha1()
            self.hash_len = 20
        except:
            try:
                import sha
                self.hash = sha.new()
                self.hash_len = 20
            except:
                import md5
                self.hash = md5.new()
                self.hash_len = 16
        self.pool = bytearray(b'\0' * self.hash_len)
        if seed is not None:
            self.stir(bytearray(seed))
            self.seeded = True
        else:
            self.seeded = False 
開發者ID:MrH0wl,項目名稱:Cloudmare,代碼行數:26,代碼來源:entropy.py


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