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


Python Thread.communicate方法代码示例

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


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

示例1: _convertMainLoop

# 需要导入模块: from threading import Thread [as 别名]
# 或者: from threading.Thread import communicate [as 别名]
 def _convertMainLoop(self, track_id):
   '''Function that iterates over tracks to convert them.'''
   t00 = time.time();                                                          # Get time for start of iteration over tracks
   self.__cnt = 0;                                                             # Reset the count for cnt attribute
   for track in track_id:                                                      # Iterate over all tracks
     info = self.itunes_data['Tracks'][track];                                 # Get the information about the track
     proc = self._processChecker();                                            # Block to ensure there aren't too many process
     proc = Thread(target = self._convertThread, args = (info,) );             # Initialize thread
     proc.start();                                                             # Start thread
     self.process.append( proc );                                              # Append thread to process list
   while len(self.process) > 0:                                                # While there are processes left int he process attribute
     proc = self.process.pop();                                                # Pop processes off the process attribute list
     try:                                                                      # Try to
       proc.join();                                                            # Join the process
     except:                                                                   # On exception
       proc.communicate();                                                     # Communicate with process
   if self.verbose:                                                            # If verbose
     print( 'Elapsed: {} {}'.format( round((time.time()-t00)/60),'min' ) );    # Print elapsed time if verbose is true
     if self.gui: print( 'Waiting for GUI to close...' );
开发者ID:kwodzicki,项目名称:iTunes_Music_Converter,代码行数:21,代码来源:iTunes_Music_Converter.py


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