@@ -125,13 +125,6 @@ def __init__(self, loader):
125
125
126
126
self ._init_thread ()
127
127
128
- # if user exit python program when dataloader is still
129
- # iterating, resource may no release safely, so we
130
- # add __del__ function to to CleanupFuncRegistrar
131
- # to make sure __del__ is always called when program
132
- # exit for resoure releasing safely
133
- CleanupFuncRegistrar .register (self .__del__ )
134
-
135
128
def _init_thread (self ):
136
129
self ._var_names = [v .name for v in self ._feed_list ]
137
130
self ._shapes = [v .shape for v in self ._feed_list ]
@@ -229,9 +222,7 @@ def __next__(self):
229
222
def _shutdown_thread (self ):
230
223
if self ._thread :
231
224
self ._thread_done_event .set ()
232
- if self ._thread is not threading .current_thread ():
233
- self ._thread .join ()
234
- self ._thread = None
225
+ self ._thread = None
235
226
236
227
# python2 compatibility
237
228
def next (self ):
@@ -287,17 +278,6 @@ def __init__(self, loader):
287
278
self ._init_thread ()
288
279
self ._shutdown = False
289
280
290
- # if user exit python program when dataloader is still
291
- # iterating, resource may no release safely, so we
292
- # add _shutdown_on_exit function to to CleanupFuncRegistrar
293
- # to make sure _try_shutdown_all is always called when program
294
- # exit for resoure releasing safely
295
- # worker join may hang for in _try_shutdown_all call in atexit
296
- # for main process is in atexit state in some OS, so we add
297
- # timeout=1 for shutdown function call in atexit, for shutdown
298
- # function call in __del__, we keep it as it is
299
- CleanupFuncRegistrar .register (self ._shutdown_on_exit )
300
-
301
281
def _init_workers (self ):
302
282
# multiprocess worker and indice queue list initial as empty
303
283
self ._workers = []
0 commit comments