• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python mutex.mutex函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中mutex.mutex函数的典型用法代码示例。如果您正苦于以下问题:Python mutex函数的具体用法?Python mutex怎么用?Python mutex使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: __init__

    def __init__(self, crypter, negotiator):
        asynchat.async_chat.__init__(self)
        self.received_data = ''
        self.crypter = crypter
        self.negotiator = negotiator
        self.set_terminator(MessageManager.MULTI_MESSAGE_DELIMITER)
        self.negotiation_lock = mutex.mutex()
        self.progress_lock = mutex.mutex()
        self.in_step_through_mode = False
        self.shared_secret = ""
        self.integrity_hash = None

        self.logger = None
        self.debugger = None
        self.debugger_raw = None
开发者ID:fgfl,项目名称:EECE412_VPN,代码行数:15,代码来源:SecureVpn.py


示例2: __init__

 def __init__(self):
   try:
     self.mutex
   except:
     self.audioProxy = naoqi.ALProxy("ALAudioPlayer")        
     self.mutex = mutex.mutex()
     self.aSoundBank = {}
开发者ID:Mister-Jingles,项目名称:NAO-EPITECH,代码行数:7,代码来源:SoundManager.py


示例3: __init__

 def __init__(self, screen, num, image, sprites):
     """
     initialising
     :param screen: main view screen
     :param num: number of client
     :param image: image of player
     :param sprites: another objects in game
     :param players: another players
     :return:
     """
     self.active = False
     self.sprites = sprites
     self.movingright = False
     self.movingleft = False
     self.num = num
     self.__posx = random.randint(0, LENGTH_BOUND)
     self.__posy = random.randint(MAGIC_TWNT, HIGH_BOUND - DIST_DIFF)
     self.playerview = PlayerView(screen, self, image)
     self.dx = 0
     self.jumping = False
     self.jump_speed = 0
     self.jump_acceleration = 0
     self.landed = False
     self.died = False
     self.send_died = False
     self.score = 0
     self.onboard = False
     self.movingactions = dict()
     self.movingactions[LEFT] = self.lefthandler
     self.movingactions[RIGHT] = self.righthandler
     self.movingactions[JUMP] = self.jumphandler
     self.mutex = mutex.mutex()
开发者ID:fettsery,项目名称:jumpNbump,代码行数:32,代码来源:sprites.py


示例4: compare_all_files

def compare_all_files(file_name = 'file', magdir = 'Magdir', exact = False):
	pool = ThreadPool(4)
	m = mutex.mutex()

	split_patterns(magdir, file_name)
	compile_patterns(file_name)
	compiled = is_compilation_supported(file_name)

	entries = get_stored_files("db")

	def store_mimedata(data):
		metadata = get_full_metadata(data[0], file_name, compiled)
		stored_metadata = get_stored_metadata(data[0])
		text = "PASS " + data[0]
		if is_regression(stored_metadata, metadata, exact):
			text = "FAIL " + data[0] + "\n" + get_diff(stored_metadata, metadata, exact)
		return text

	def data_print(data):
		print data
		m.unlock()

	def data_stored(data):
		m.lock(data_print, data)

	for i,entry in enumerate(entries):
		# Insert tasks into the queue and let them run
		pool.queueTask(store_mimedata, (entry, i % 2), data_stored)

	# When all tasks are finished, allow the threads to terminate
	pool.joinAll()
	print ''
开发者ID:hanzz,项目名称:file,代码行数:32,代码来源:compare-db.py


示例5: __init__

	def __init__(self):
		self.node_name = rospy.get_name()
		self.bridge = CvBridge()
		self.active = True
		self.config	= self.setupParam("~config", "baseline")
		self.cali_file_name = self.setupParam("~cali_file_name", "default")
		rospack = rospkg.RosPack()
		self.cali_file = rospack.get_path('duckietown') + \
				"/config/" + self.config + \
				"/vehicle_detection/vehicle_detection_node/" +  \
				self.cali_file_name + ".yaml"
		if not os.path.isfile(self.cali_file):
			rospy.logwarn("[%s] Can't find calibration file: %s.\n" 
					% (self.node_name, self.cali_file))
		self.loadConfig(self.cali_file)
		self.sub_image = rospy.Subscriber("~image", Image, 
				self.cbImage, queue_size=1)
		self.sub_switch = rospy.Subscriber("~switch", BoolStamped,
				self.cbSwitch, queue_size=1)
		self.pub_detection = rospy.Publisher("~detection", 
				BoolStamped, queue_size=1)
		self.pub_circlepattern_image = rospy.Publisher("~circlepattern_image", 
				Image, queue_size=1)
		self.pub_time_elapsed = rospy.Publisher("~detection_time",
			Float32, queue_size=1)
		self.lock = mutex()
		rospy.loginfo("[%s] Initialization completed" % (self.node_name))
开发者ID:ChuangWang-Zoox,项目名称:Software,代码行数:27,代码来源:vehicle_detection_node.py


示例6: __init__

 def __init__(self, value_type=None, py_value=None):
     self._del_mutex = mutex.mutex()
     GObjectModule.Value.__init__(self)
     if value_type is not None:
         self.init(value_type)
         if py_value is not None:
             self.set_value(py_value)
开发者ID:pexip,项目名称:pygobject,代码行数:7,代码来源:GObject.py


示例7: __init__

 def __init__(self):
     if( system.isOnNao() ):
         self.strFileName = "/home/nao/www/blog/index.html";
     elif( system.isOnWin32() ):
         self.strFileName = "D:/ApacheRootWebSite2/htdocs/naoblog/index.html";
     else:
         self.strFileName = "/www/blog";
         
     self.strImgFolderAbs = os.path.dirname( self.strFileName ) + "/img/";
     self.strImgFolderLocal = "img/";        
     self.strEmoFolderAbs = os.path.dirname( self.strFileName ) + "/emo/";
     self.strEmoFolderLocal = "emo/";
     
     self.logMutex = mutex.mutex();
     self.logLastTime = None;
     
     # constants:
     self.none = 0;
     self.happy = 1;
     self.sad = 2;
     self.proud = 3;
     self.excitement = 4;
     self.fear = 5;
     self.anger = 6;
     self.neutral = 7;
     self.hot= 8;
开发者ID:Mister-Jingles,项目名称:NAO-EPITECH,代码行数:26,代码来源:blog.py


示例8: __init__

    def __init__(self, needed_caps):
        self._width = None
        self._height = None
        self._current_frame = None
        gobject.threads_init()
        self._mutex = mutex()
        gst.Bin.__init__(self)
        self._capsfilter = gst.element_factory_make('capsfilter', 'capsfilter')

        self.set_caps(needed_caps)
        self.add(self._capsfilter)
        
        fakesink = gst.element_factory_make('fakesink', 'fakesink')
        fakesink.set_property("sync", True)
        self.add(fakesink)
        self._capsfilter.link(fakesink)
        
        pad = self._capsfilter.get_pad("sink")
        ghostpad = gst.GhostPad("sink", pad)
        
        pad2probe = fakesink.get_pad("sink")
        pad2probe.add_buffer_probe(self.buffer_probe)

        self.add_pad(ghostpad)
        self.sink = self._capsfilter
开发者ID:BackupTheBerlios,项目名称:elisa-svn,代码行数:25,代码来源:player.py


示例9: __init__

 def __init__(self):
   try:
     self.mutex
   except:
     self.fm = naoqi.ALProxy("ALFrameManager")
     self.mutex = mutex.mutex()
     self.aLoaded = {}
     self.aRunning = {}
开发者ID:Mister-Jingles,项目名称:NAO-EPITECH,代码行数:8,代码来源:LoadingManager3.py


示例10: __init__

 def __init__(self):
     debug.debug( "INF: PersistentMemoryDataManager.__init__ called" );
     self.allData = {};
     self.mutexListData = mutex.mutex();
     try:
         os.makedirs( PersistentMemoryData.getVarPath() );
     except:
         pass # le dossier existe deja !
开发者ID:Mister-Jingles,项目名称:NAO-EPITECH,代码行数:8,代码来源:persistent_memory.py


示例11: __init__

 def __init__(self) :
     self.map_data = {}
     self.building_names = {}
     self.map_mutex = mutex.mutex()
     for i in range(10000) :
         self.map_data[i] = UDMapEntry(i)
     self.load()
     self.load_types()
开发者ID:kimihia,项目名称:udbraaains,代码行数:8,代码来源:udserver.py


示例12: __init__

  def __init__(self, settings, camera):
    self.settings = settings
    self.camera = camera
    self.mutex = mutex.mutex()

    self.jancodes = []
    self.last_appear_time = time.time()
    self.shuttered = False
开发者ID:MKnkgw,项目名称:MakeShareLog,代码行数:8,代码来源:dresser_handler.py


示例13: __init__

	def __init__(self):
		self.__cmdRegex = re.compile("(?P<qtype>who|what|where|when) (?P<verb>is|are|was|were) (?P<query>[^?]+)", re.I)
		self.__cacheFile = "googlism_cache"
		try: self.__cache = shelve.open(self.__cacheFile, protocol=2)
		except TypeError:
			# pre-2.3 didn't have a protocol argument.
			self.__cache = shelve.open(self.__cacheFile)
		self.__cacheMutex = mutex.mutex()
		self.__cacheKeys = self.__cache.keys()
开发者ID:B-Rich,项目名称:Howie,代码行数:9,代码来源:googlism.py


示例14: __init__

 def __init__(self, eventTgt):
     logging.debug( 'Harmony __INIT__ ' )
     self._eventTgt = eventTgt
     threading.Thread.__init__(self)
     self.harmonySkt = None
     self.bufferedData = ""
     self.opened = False
     self.running = True
     self.mut = mutex.mutex()
开发者ID:LawrenceK,项目名称:webbrick,代码行数:9,代码来源:Harmony.py


示例15: _install_restore_mode_child

def _install_restore_mode_child():
    global _mode_write_pipe
    global _restore_mode_child_installed

    if _restore_mode_child_installed:
        return

    # Parent communicates to child by sending "mode packets" through a pipe:
    mode_read_pipe, _mode_write_pipe = os.pipe()

    if os.fork() == 0:
        # Child process (watches for parent to die then restores video mode(s).
        os.close(_mode_write_pipe)

        # Set up SIGHUP to be the signal for when the parent dies.
        PR_SET_PDEATHSIG = 1
        libc = ctypes.cdll.LoadLibrary('libc.so.6')
        libc.prctl.argtypes = (ctypes.c_int, ctypes.c_ulong, ctypes.c_ulong,
                               ctypes.c_ulong, ctypes.c_ulong)
        libc.prctl(PR_SET_PDEATHSIG, signal.SIGHUP, 0, 0, 0)

        # SIGHUP indicates the parent has died.  The child mutex is unlocked, it
        # stops reading from the mode packet pipe and restores video modes on
        # all displays/screens it knows about.
        def _sighup(signum, frame):
            parent_wait_mutex.unlock()
        parent_wait_mutex = mutex.mutex()
        parent_wait_mutex.lock(lambda arg: arg, None)
        signal.signal(signal.SIGHUP, _sighup)

        # Wait for parent to die and read packets from parent pipe
        packets = []
        buffer = ''
        while parent_wait_mutex.test():
            try:
                data = os.read(mode_read_pipe, ModePacket.size)
                buffer += data
                # Decode packets
                while len(buffer) >= ModePacket.size:
                    packet = ModePacket.decode(buffer[:ModePacket.size])
                    packets.append(packet)
                    buffer = buffer[ModePacket.size:]
            except OSError:
                pass # Interrupted system call

        for packet in packets:
            packet.set()
        os._exit(0)
        
    else:
        # Parent process.  Clean up pipe then continue running program as
        # normal.  Send mode packets through pipe as additional
        # displays/screens are mode switched.
        os.close(mode_read_pipe)
        _restore_mode_child_installed = True
开发者ID:consultit,项目名称:lithosphere,代码行数:55,代码来源:xlib_vidmoderestore.py


示例16: __init__

	def __init__(self):
		self.node_name = "Image Average"
		self.bridge = CvBridge()
		self.pub_image = rospy.Publisher("~average_image", Image, queue_size=1)
		self.sub_image = rospy.Subscriber("/ferrari/camera_node/image/compressed", CompressedImage, 
				self.cbImage, queue_size=1)
		rospy.loginfo("Initialization of [%s] completed" % (self.node_name))
		self.lock = mutex()
		self.lock.unlock()
		self.avg_img = None
		self.count_images = 0
开发者ID:71ananab,项目名称:Software,代码行数:11,代码来源:image_average_node.py


示例17: __init__

 def __init__(self):
     print('intiailizing processing')
     self.gpsmutex = mutex()
     self.estmutex = mutex()
     self.attmutex = mutex()
     self.radarmutex = mutex()
     self.radarmsgavailable = False
     self.gpsavail = threading.Event()
     self.estavail = threading.Event()
     self.attavail = threading.Event()
     self.radarupdate = threading.Event()
     self.att = None
     self.est = None
     self.gps = None
     self.lastatt = None
     self.lastest = None
     self.lastgps = None
     self.I = None
     self.lastI = None
     self.radarmsgavailable = False
     self.shutdown = False
开发者ID:rijesha,项目名称:radarlink,代码行数:21,代码来源:processing.py


示例18: test_all_files

def test_all_files(exact=False, binary="file"):
    """Compare output of given file(1) binary with db for all entries."""
    global ret
    ret = 0

    print_file_info(binary)

    print_lock = mutex.mutex()

    entries = sorted(get_stored_files("db"))

    def store_mimedata(filename):
        """Compare file(1) output with db for single entry."""
        metadata = get_simple_metadata(filename, binary)
        try:
            stored_metadata = get_stored_metadata(filename)
        except IOError:
            # file not found or corrupt
            text = "FAIL " + filename + "\n" + \
                   "FAIL   could not find stored metadata!\n" + \
                   "This can mean that the File failed to generate " + \
                   "any output for this file."
        else:
            text = "PASS " + filename
            if is_regression(stored_metadata, metadata, exact):
                text = "FAIL " + filename + "\n" + \
                       get_diff(stored_metadata, metadata, exact)
        return text

    def data_print(data):
        """Print given text, set global return value, unlock print lock."""
        print(data)
        if data[0] == "F":
            global ret
            ret = 1
        print_lock.unlock()

    def data_stored(data):
        """Acquire print lock and call :py:function:`data_print`."""
        print_lock.lock(data_print, data)

    # create here so program exits if error occurs earlier
    n_threads = 1
    pool = ThreadPool(n_threads)

    for entry in entries:
        # Insert tasks into the queue and let them run
        pool.queueTask(store_mimedata, entry, data_stored)

    # When all tasks are finished, allow the threads to terminate
    pool.joinAll()
    print('')
    return ret
开发者ID:christian-intra2net,项目名称:file-tests,代码行数:53,代码来源:fast-regression-test.py


示例19: __init__

    def __init__(self, parent):
        """クラスの初期化


        [引数]
        parent -- 親クラス

        [戻り値]
        void
        """
        RtmDictCore.__init__(self, parent)
        self.parent = parent
        self.Mutex = mutex.mutex()
开发者ID:pansas,项目名称:OpenRTM-aist-portable,代码行数:13,代码来源:RtmCompData.py


示例20: __init__

	def __init__(self, name, notebook):
		wx.PyLog.__init__(self)
		self.tc = wx.TextCtrl(notebook, -1, style = wx.TE_MULTILINE|wx.TE_READONLY)
		self.logTime = True
		self.mutex = mutex.mutex() #control access to text controls
		self.name = name
		try:
			os.mkdir('logs')
		except OSError:
			#directory already exists
			pass
			
		self.filename = 'logs/'+time.strftime("%Y%m%d-%H%M")+self.name+'.txt'
		self.logfile_opened = False
开发者ID:jlev,项目名称:freedomflies,代码行数:14,代码来源:log.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.debug函数代码示例发布时间:2022-05-27
下一篇:
Python output.Output类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap