本文整理汇总了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...' );