lxc / python3-lxc

Python 3.x binding for liblxc
https://linuxcontainers.org/lxc
GNU Lesser General Public License v2.1
57 stars 38 forks source link

Unlock GIL while creating container #29

Closed Consolatis closed 3 years ago

Consolatis commented 3 years ago

Pretty useful if running .create() in a thread, either manually or via asyncio run_in_executor()

I am not 100% sure if it's ok to release the GIL while using Py_{True,False}. It should be fine as Py_INCREF() comes later. If there are any doubts I could change this to use a temporary return var and have the check after Py_END_ALLOW_THREADS.

stgraber commented 3 years ago

@Consolatis looks like this needs a quick rebase :)

Consolatis commented 3 years ago

@Consolatis looks like this needs a quick rebase :)

Still not 100% sure if it's fine to use Py_{True,False} without GIL but branch is rebased

stgraber commented 3 years ago

I'd think it's fine, it's just a simple assignment, it doesn't mess with any shared memory with Python or calls any function.

Consolatis commented 3 years ago

Thank you for your quick feedback. 10 / 10, would commit again.