当前位置: 首页>>代码示例>>Python>>正文


Python Thread.__init__方法代码示例

本文整理汇总了Python中threading.Thread.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Thread.__init__方法的具体用法?Python Thread.__init__怎么用?Python Thread.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在threading.Thread的用法示例。


在下文中一共展示了Thread.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self, function, sleep=30):
        Thread.__init__(self)

        self.daemon = True
        self.sleepTime = sleep
        self.runTimer = True
        self.function = function
开发者ID:mhartkorn,项目名称:twidderbot,代码行数:9,代码来源:twidderbot.py

示例2: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, interval_sec, get_connection_holders):
     Thread.__init__(self, name="Connection heartbeat")
     self._interval = interval_sec
     self._get_connection_holders = get_connection_holders
     self._shutdown_event = Event()
     self.daemon = True
     self.start()
开发者ID:sakura-sky,项目名称:python-driver,代码行数:9,代码来源:connection.py

示例3: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, req, proxy, logger, task, exit_check=None, ignored_errors=[]):
     Thread.__init__(self, name = "monitor%s" % task.guid)
     Thread.setDaemon(self, True)
     # the count of votes per error code
     self.vote_result = {}
     # the error code to be ignored
     self.vote_cleared = set().union(ignored_errors)
     self.thread_last_seen = {}
     self.dctlock = RLock()
     self.votelock = RLock()
     self.thread_ref = {}
     self.thread_zombie = set()
     # HttpReq instance
     self.req = req
     # proxy.Pool instance
     self.proxy = proxy
     self.logger = logger
     self.task = task
     self._exit = exit_check if exit_check else lambda x: False
     self._cleaning_up = False
     if os.name == "nt":
         self.set_title = lambda s:os.system("TITLE %s" % (
             s if PY3K else s.encode(CODEPAGE, 'replace')))
     elif os.name == 'posix':
         import sys
         self.set_title = lambda s:sys.stdout.write("\033]2;%s\007" % (
             s if PY3K else s.encode(CODEPAGE, 'replace')))
开发者ID:fffonion,项目名称:xeHentai,代码行数:29,代码来源:worker.py

示例4: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, name, event, function, args=[], period = 5.0):
     Thread.__init__(self)
     self.name = name
     self.stopped = event
     self.period = period
     self.function = function
     self.args = args
开发者ID:Aegeaner,项目名称:ceph-dash,代码行数:9,代码来源:probe.py

示例5: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self, prompt="> ", stdin=None, stdout=None):
        if _debug: ConsoleCmd._debug("__init__")
        cmd.Cmd.__init__(self, stdin=stdin, stdout=stdout)
        Thread.__init__(self, name="ConsoleCmd")

        # check to see if this is running interactive
        self.interactive = sys.__stdin__.isatty()

        # save the prompt for interactive sessions, otherwise be quiet
        if self.interactive:
            self.prompt = prompt
        else:
            self.prompt = ''

        # gc counters
        self.type2count = {}
        self.type2all = {}

        # logging handlers
        self.handlers = {}

        # set a INT signal handler, ^C will only get sent to the
        # main thread and there's no way to break the readline
        # call initiated by this thread - sigh
        if hasattr(signal, 'SIGINT'):
            signal.signal(signal.SIGINT, console_interrupt)

        # start the thread
        self.start()
开发者ID:DemandLogic,项目名称:bacpypes,代码行数:31,代码来源:consolecmd.py

示例6: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, params):
     Thread.__init__(self)
     self.tid          = params['tid']                              #work线程id
     self.apns_gateway = ApnsGateway(certfile=params['certfile'],   #apns连接
                                         host=params['host'],
                                         port=params['port'],
                                        retry=params['retry'])   
开发者ID:dragonflylxp,项目名称:ios-pushserver,代码行数:9,代码来源:thread_push.py

示例7: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, config, pipe_name=PIPE):
     """@param pipe_name: Cuckoo PIPE server name."""
     Thread.__init__(self)
     self.pipe_name = pipe_name
     self.config = config
     self.options = config.get_options()
     self.do_run = True
开发者ID:marek2003,项目名称:cuckoo-modified,代码行数:9,代码来源:analyzer.py

示例8: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
	def __init__(self):
		Thread.__init__(self)

		self.daemon = True

		# flush the input buffer
		ser.read(1000)
开发者ID:asyring,项目名称:FPGA-Litecoin-Miner,代码行数:9,代码来源:ltcminer-ncurses.py

示例9: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
  def __init__(self, app, baseurl, mount, cacertdir = "/etc/grid-security/certificates", minreq = 1000, interval = 300, instance = "test"):
    Thread.__init__(self, name = "LdapSync")
    self.sectoken = "".join(random.sample(string.letters, 30))
    self._inturl = "http://localhost:%d%s/%s/ldapsync" % \
                   (app.srvconfig.port, mount, instance)
    self._headers = \
      fake_authz_headers(open(app.srvconfig.tools.cms_auth.key_file).read(),
                         method = "Internal", login = self.sectoken,
                         name = self.__class__.__name__, dn = None,
                         roles = {"Global Admin": {"group": ["global"]}}) \
      + [("Accept", "application/json")]

    self._cv = Condition()
    if isinstance(baseurl, str):
      self._baseurl = baseurl

    self._cacertdir = cacertdir
    self._minreq = minreq
    self._interval = interval
    self._stopme = False
    self._full = (0, [], [])
    self._warnings = {}

    self._intreq = RequestManager(num_connections = 2,
                                  user_agent = self._ident,
                                  handle_init = self._handle_init,
                                  request_respond = self._respond,
                                  request_init = self._int_init)
    cherrypy.engine.subscribe("stop", self.stop)
    cherrypy.engine.subscribe("start", self.start)
开发者ID:amaltaro,项目名称:sitedb,代码行数:32,代码来源:DataLdapSync.py

示例10: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self, sock):
        Thread.__init__(self)
        self.sendingQueue = Utils.globals.sendingQueue
        self.sock = sock
        self.ping = ""

        self.outfile = open("data_received_from_node.txt", 'w')
开发者ID:peschir,项目名称:Bitpy,代码行数:9,代码来源:ReceiverManager.py

示例11: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self):
        Thread.__init__(self)
        self.daemon = True
        self.start()
        self.status = ''

        self._sleep_time = 0
开发者ID:paulprinke,项目名称:OSPi,代码行数:9,代码来源:lcd_adj.py

示例12: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, proxy, url, file):
     Thread.__init__(self)
     self.proxy = proxy
     self.url = url
     self.file = file
     self.result = False
     self.data = ""
开发者ID:hansenrl,项目名称:cs118-project1,代码行数:9,代码来源:http-tester-20.py

示例13: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self, sensor_name, sensor_type, serial):
        Thread.__init__(self)
        if sensor_name[-1] == '/':
            sensor_name = sensor_name[:-1]
        
        if (sensor_type == "Kinect2") or (sensor_type == "Kinectv2") or (sensor_type == "Kinect_v2"):
            self.kinect_type = "Kinect2"
            print "Loading Kinect2 with serial : "+serial 
            self.kinect = Kinect_v2(sensor_name,serial,queue_size=10,compression=False,use_rect=True,use_ir=True)
            
        elif (sensor_type == "Kinect") or (sensor_type == "Kinect1") or (sensor_type == "Kinectv1") or (sensor_type == "Kinect_v1"):
            self.kinect_type = "Kinect1"
            print "Loading "+sensor_name+" of type Kinect1"
            self.kinect = Kinect(sensor_name,queue_size=10,compression=False,use_rect=True,use_depth_registered=True,use_ir=False)
        else:
            print "ERROR: Sensor type must be Kinect2 or Kinect"
            return       
        
        self.sensor_name = sensor_name

        self.kinect.wait_until_ready()
        
        self.listener = tf.TransformListener()
        
        self.list_robot_links = ['link_0','link_1','link_2','link_3','link_4','link_5','link_6','link_7']
        
        self.last_pose = None
        
        rospy.Subscriber("/kinect_merge/tracking_state", MarkerArray , self.callback)
开发者ID:kuka-isir,项目名称:kinects_human_tracking,代码行数:31,代码来源:tracking_visu.py

示例14: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
    def __init__(self, files, outDir, dirFormat, fileFormat,
                 anon=dict(), keep_filename=False, iterator=None,
                 test=False, listener=None, total=None, root=None, seriesFirst=False):

        self.dirFormat = dirFormat
        self.fileFormat = fileFormat
        self.fileList = files
        self.anondict = anon
        self.keep_filename = keep_filename
        self.seriesFirst = seriesFirst
        self.outDir = outDir
        self.test = test
        self.iter = iterator
        self.root = root

        if not isinstance(self.fileList, tuple):
            self.fileList = (self.fileList,)

        if total is None:
            self.total = len(self.fileList)
        else:
            self.total = total

        self.isgui = False

        if listener:
            self.listener = listener
            self.isgui = True

        Thread.__init__(self)
        self.start()
开发者ID:kayarre,项目名称:dicomSort,代码行数:33,代码来源:dicomsorter.py

示例15: __init__

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import __init__ [as 别名]
 def __init__(self, model=None, ishome=False):
     IdleObject.__init__(self)
     Thread.__init__(self)
     self.model = model
     self.ishome = ishome
     self.daemon = True
     self.stop = False
开发者ID:atareao,项目名称:antiviral,代码行数:9,代码来源:antiviral.py


注:本文中的threading.Thread.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。