<div dir="ltr"><div><br></div><div>Hi,</div><div><br></div><div>I don't know if there is a third party solution for this.</div><div><br></div>I think the closest you can get today using the standard library is using a multiprocessing.manager().Lock (which can be shared among processes) and call the lock.acquire() function with asyncio.run_in_executor(), using a ThreadedPoolExecutor to avoid blocking the asyncio event loop.<div><br></div><div>Best regards,</div><div>Roberto</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">El mar., 17 abr. 2018 a las 0:05, Ludovic Gasc (<<a href="mailto:gmludo@gmail.com">gmludo@gmail.com</a>>) escribió:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<div><br></div><div>I'm looking for a equivalent of asyncio.Lock (<a href="https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock" target="_blank">https://docs.python.org/3/library/asyncio-sync.html#asyncio.Lock</a>) but shared between several processes on the same server, because I'm migrating a daemon from mono-worker to multi-worker pattern.</div><div><br></div><div>For now, the closest solution in term of API seems aioredlock: <a href="https://github.com/joanvila/aioredlock#aioredlock" target="_blank">https://github.com/joanvila/aioredlock#aioredlock</a></div><div>But I'm not a big fan to use polling nor with a timeout because the lock I need is very critical, I prefer to block the code than unlock with timeout.</div><div><br></div><div>Do I miss a new awesome library or do you have an easier approach ?</div><div><br></div><div>Thanks for your responses.</div><div><div><div class="m_4018044833986342039gmail_signature"><div dir="ltr"><div><div dir="ltr"><div dir="ltr">--<br><div style="font-size:small"><div>Ludovic Gasc (GMLudo)</div></div></div></div></div></div></div></div>
</div></div>
</blockquote></div>