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

Fix crash libpd_openfile due to lock #178

Merged
merged 11 commits into from Nov 3, 2017

Conversation

pierreguillot
Copy link
Contributor

It seems that libpd_openfile() needs to lock the global pd's mutex for writing otherwise because glob_evalfile() uses static variable and if several instances call this function it crashes.

@danomatika
Copy link
Member

Thanks for checking this. Do we need both sys_lock and the globallock? I don't know, just checking.

@pierreguillot
Copy link
Contributor Author

Yes because sys_lock() lock the instance and enables pd_this->pd_islocked = 1; then globallock() checks this value if (!pd_this->pd_islocked) bug("pd_globallock");

@pierreguillot
Copy link
Contributor Author

I can also add my test (samples/c/pdtest_thread) from this branch but it's a bit dirty for the moment

@danomatika
Copy link
Member

Adding a test is a good idea. I recently cleaned up the makefiles so they they should be easy to adapt. The plan in the future is to update libpd to use auto tools.

@danomatika
Copy link
Member

danomatika commented Jul 21, 2017

Looks good. Let me know when you feel the PR is ready. I'm thinking we will also provide a libpd wrapper for pd_instance such as libpd_set_instance or something similar soon.

@pierreguillot
Copy link
Contributor Author

I think it's ready for this PR. Sorry for the slowness :)

@danomatika
Copy link
Member

danomatika commented Nov 2, 2017

If you use the current master branch, you could update the test to use the "libpd_*_instance" functions. Also, the main Makefile now has a "MULTI" build option so you no longer need to set PDINSTANCE and PDTHREADS in the test Makefile. Build libpd with multiple instance support via: make MULTI=true.

@pierreguillot
Copy link
Contributor Author

Done ! Thanks

@danomatika danomatika merged commit 00bc87f into libpd:master Nov 3, 2017
@pierreguillot pierreguillot deleted the fix/threadable branch November 3, 2017 14:05
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.

None yet

2 participants