File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -426,3 +426,32 @@ def page_size(self):
426426 return PAGESIZE
427427
428428 #} END interface
429+
430+ #{ Special Purpose Interface
431+
432+ def force_map_handle_removal_win (self , base_path ):
433+ """ONLY AVAILABLE ON WINDOWS
434+ On windows removing files is not allowed if anybody still has it opened.
435+ If this process is ourselves, and if the whole process uses this memory
436+ manager (as far as the parent framework is concerned) we can enforce
437+ closing all memory maps whose path matches the given base path to
438+ allow the respective operation after all.
439+ The respective system must NOT access the closed memory regions anymore !
440+ This really may only be used if you know that the items which keep
441+ the cursors alive will not be using it anymore. They need to be recreated !
442+ :return: Amount of closed handles
443+ :note: does nothing on non-windows platforms"""
444+ if sys .platform != 'win32' :
445+ return
446+ #END early bailout
447+
448+ num_closed = 0
449+ for path , rlist in self ._fdict .iteritems ():
450+ if path .startswith (base_path ):
451+ for region in rlist :
452+ region ._mf .close ()
453+ num_closed += 1
454+ #END path matches
455+ #END for each path
456+ return num_closed
457+ #} END special purpose interface
You can’t perform that action at this time.
0 commit comments