Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap render function in SWIG threads macro, to disable Python GIL #102

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

stephen322
Copy link

My attempt at issue #98 -- a new wrapper function to disable Python GIL during rendering.
It-Works-For-Me...

This is so unrelated Python threads can run while ws2812 does its thing. I'm not trying to imply rpi_ws281x is thread-safe.

Not sure why the SWIG-generated files have different formatting than what was there.
I used "swig -python -threads".

Amended after running black formatting
@stephen322
Copy link
Author

Ah, files are re-formated by black.
Amended commit.

Add build instructions, update c library url.
SWIG build has '-threads' argument for recent GIL patch.
@Gadgetoid
Copy link
Member

Thanks for putting in the effort to PR this. I don't use WS281x pixels as much as I did when I first adopted this library, so I'm pressed for time and incentive to give it a proper test.

Any drive-by volunteers who fire up this code and find the changes useful, your comments would be very helpful!

@stephen322
Copy link
Author

This patch was designed to make its use optional, so in theory should be the same as before.
Although there is the new threading import dependency in python for the mutex, and I wouldn't know what other things swig might do behind-the-scenes with threading enabled...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants