Conversation
| // XXX: same for the repository pool... | ||
| if (uninstalled) { | ||
| (void)xbps_pkgdb_get_pkg(xhp, "foo"); | ||
| } else { | ||
| (void)xbps_rpool_get_pkg(xhp, "package-that-wont-exist-so-it-loads-all-repos"); | ||
| } |
There was a problem hiding this comment.
Would it make sense to make xbps_pkgdb_init and xbps_rpool_init thread-safe with pthread_mutex_t? This would eliminate the need for workarounds and make lazy initialization work safely whether called from single-threaded or multithreaded code. The performance overhead should be negligible since the mutex is only contended during the initial load.
This would also help prevent similar issues.
Happy to take a stab at implementing this if you think it's worthwhile.
There was a problem hiding this comment.
My plan was to remove the lazy initialization instead.
There was a problem hiding this comment.
I thought about that too, although it will be a breaking API change. How is something like that normally coordinated?
No description provided.