Пример #1
0
 def download(self):
     global g_mutex
     while True:
         print 'b here'
         providerid = None
         g_mutex.acquire()
         print 'b there'
         for pid in self.dict_provider:
             #Log.info("for %s,%s" %( pid, self.dict_provider[pid]))
             if self.dict_provider[pid]==0:
                 #g_mutex.acquire()
                 self.dict_provider[pid] = 1
                 providerid = pid
                 break
                 #g_mutex.release()
         g_mutex.release()
         print 'b done'
         if providerid is None:
             #time.sleep(10)
             continue
         
         Log.info("download for providerid: %s" % providerid)
         
         g_mutex.acquire()
         self.dict_provider[providerid]=2
         #del self.dict_provider[providerid]
         g_mutex.release()
Пример #2
0
 def download(self, providerid):
     # providerid = ''.join(pids)
     Log.info("download for providerid: %s" % providerid)
     global g_mutex
     g_mutex.acquire()
     self.dict_provider[providerid] = 2
     # del self.dict_provider[providerid]
     g_mutex.release()
Пример #3
0
def test_func1():
    '''
    test_func1 name
    '''
    Log.debug('it is debug')
    Log.info('it is info')
    
    Log.warn('it is warn')
    
    Log.error('it is error')
    
    Log.debug('it is debug')
    Log.info('it is info')
    
    Log.warn('it is warn')
    
    Log.error('it is error')
    
    Log.live("it is live")
Пример #4
0
    def get_providers(self):
        global g_mutex

        while True:
            Log.info("load provider")
            g_mutex.acquire()
            for i in range(30):
                id = random.randint(1, 200)
                if id in self.dict_provider and self.dict_provider[id] == 1:
                    pass
                else:
                    self.dict_provider[id] = 0

            Log.info("load provider, len: %s" % len(self.dict_provider))
            g_mutex.release()
            Log.info("get provider sleep")
            time.sleep(1)
            Log.info("get provider walk up")
Пример #5
0
def test_func7():
    while True:
        Log.info('it is info')