0

I am using FLIR Spinnaker python interface pyspin. I noticed that saving images takes a chunk of time and I want to Parallelize it so the system could be loading a new image while the current image is saving.

My confusion is on if the python threading will help or if I will need another process(which adds its own problems). Basically the system is IO bound but via the Spinnaker library call, not a python call. Will this block the thread since it's not a system IO through the python interpreter?

FourierFlux
  • 439
  • 5
  • 13
  • Is the library support async APIs? Maybe this document can help you: https://docs.python.org/3/library/asyncio-task.html#coroutines-and-tasks – WENJUN CHI Feb 21 '22 at 07:07
  • All function calls block the thread that calls them, except ones that are specifically known to be non-blocking or asynchronous. – user207421 Feb 21 '22 at 07:11
  • Thanks I added pyspin and flir to tags since they are relevant. – FourierFlux Feb 21 '22 at 07:13
  • 1
    Have you tried it? Simplest way to know how a specific library works with your code it to just create a few threads and have one of them save the image, see if it blocks. – kg_sYy Feb 21 '22 at 07:19
  • 1
    Why did you tag this question with multiprocessing? That and multithreading follow different sets of rules! That said, Python can execute other threads while one thread is blocked doing IO. I guess all built-in IO does that already, but for external modules that would be a "quality of implementation" issue whether they release the GIL. As others said: Try it! – Ulrich Eckhardt Feb 21 '22 at 07:49

0 Answers0