Skip to content

Conversation

@Consolatis
Copy link
Contributor

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
Copy link
Member

stgraber commented Oct 5, 2021

@Consolatis looks like this needs a quick rebase :)

Signed-off-by: Consolatis <35009135+Consolatis@users.noreply.github.com>
@Consolatis Consolatis force-pushed the fix/allow_threads_create branch from 18368cd to a869854 Compare October 5, 2021 05:27
@Consolatis
Copy link
Contributor Author

@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
Copy link
Member

stgraber commented Oct 5, 2021

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.

@stgraber stgraber merged commit fe79d87 into lxc:master Oct 5, 2021
@Consolatis Consolatis deleted the fix/allow_threads_create branch October 5, 2021 15:56
@Consolatis
Copy link
Contributor Author

Consolatis commented Oct 5, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants