MCPcopy Create free account
hub / github.com/numpy/numpy / single_compile

Function single_compile

numpy/distutils/ccompiler.py:308–332  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

306 log.info(display)
307
308 def single_compile(args):
309 obj, (src, ext) = args
310 if not _needs_build(obj, cc_args, extra_postargs, pp_opts):
311 return
312
313 # check if we are currently already processing the same object
314 # happens when using the same source in multiple extensions
315 while True:
316 # need explicit lock as there is no atomic check and add with GIL
317 with _global_lock:
318 # file not being worked on, start working
319 if obj not in _processing_files:
320 _processing_files.add(obj)
321 break
322 # wait for the processing to end
323 time.sleep(0.1)
324
325 try:
326 # retrieve slot from our #job semaphore and build
327 with _job_semaphore:
328 self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts)
329 finally:
330 # register being done processing
331 with _global_lock:
332 _processing_files.remove(obj)
333
334
335 if isinstance(self, FCompiler):

Callers 1

CCompiler_compileFunction · 0.85

Calls 3

_needs_buildFunction · 0.85
addMethod · 0.45
_compileMethod · 0.45

Tested by

no test coverage detected