Closed mskordal closed 7 months ago
Thank you for the PR!
Two comments:
1) Please change the commit message to "Add ...". Commits should use present, not past tense.
2) I'm not convinced we need assert(ctx == NULL)
. I think we should safely assume that plugin is registered and context created at the point the user uses this, or in fact any, helper function. So, I'd just keep the second assert, which I'm happy with. Also, adding assert(ctx == NULL)
would create a precedence for all helpers to have it, and I don't think we don't want to - the performance degradation should be marginal but still. @jkressel What do you think?
I agree, I think we need to assume that a ctx
has been created, since without it the plugin isn't registered or useful.
When in the constructor of plugins, if we call mambo_get_thread_id before mambo_register_plugin, it will cause a segmentation fault. So we added an assertion to ctx. Furthermore, if we call mambo_get_thread_id right after mambo_register_plugin while in the constructor, no thread is initialised yet which will also cause a segmentation fault due to ctx->thread_data being NULL.