Did you check the ThreadPoolExecutor or the ProcessPoolExecutor? They won't give you atomic writes unless you add a Lock or a Condition, but they will execute your code in another thread or process.
https://docs.python.org/3/library/concurrent.futures.html#threadpoolexecutor https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor Keep in mind that Python's threads have a global interpreter lock (GIL) that prevents full parallelism. Processes work as expected, but require IPC and pickable objects in and out. -- Diego Souza Wespa Intelligent Systems Rio de Janeiro - Brasil On Mon, Sep 26, 2022 at 1:01 PM <python-list-requ...@python.org> wrote: > From: Axy <a...@declassed.art> > To: Python List <python-list@python.org> > Date: Mon, 26 Sep 2022 12:17:47 +0100 > Subject: Asynchronous execution of synchronous functions > Hi there, > > is there a library to call functions in context of a thread? For > example, as in asyncsqlite which has a thread and a queue I mean has > anyone generalized such an approach already? > > If not, I'll do it myself, no problem. > > It's a kind of tiny stuff, like atomicwrites, which is quite difficult > to dig out with modern search engines that have already rolled down to > hell a decade ago. > > Axy. -- https://mail.python.org/mailman/listinfo/python-list