-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Use pthread_once to call bindtextdomain only once #32
base: i18n
Are you sure you want to change the base?
Conversation
Calling bindtextdomain everytime in discid_new incurs a little overhead. If pthread is available, we can ensure with pthread_once that bindtextdomain is called exactly once. The autoconf function AX_PTHREADS is available from autoconf-archive. In cmake FIND_LIBRARY(Threads) is used to find pthread. Signed-off-by: Sebastian Ramacher <[email protected]>
Starting to use threading just for that? Not really sure if this is worth the additional complexity. It is a performance issue as far as I understand and probably no bottleneck (compared to reading the TOC from a disc). However, if it works fine on all platforms without (much) additional work then this is possibly fine. I'll do some testing. The CI test fails:
This totally misleading error message is fixed by installing autoconf-archive on my machine, but this is yet another thing that isn't installed on the CI server and an additional dev build dependency. Not a complete showstopper, but I don't like it and it obviously won't be merged until this works on the CI server (over which I don't have full control myself). |
On 2013-07-23 16:35:24, Johannes Dewender wrote:
Does linking against pthread introduce threading? We're not creating threads or
As usual with autoconf macros, one can just drop the macro in m4 (or any If you prefer that, please let me know. Otherwise it should be easy If you don't like the pthread solution, we can also do one of the following:
|
We are not using multi-threading but we are using platform dependent threading mechanisms. Which would be meaningless if this would be a linux-only library, but raises maintenance effort getting this to work on every supported platform.
That would be worse, because then we have to maintain a 300 line m4 script in our code. (Yes, there is a possibility we never have to change anything at all, but also one having weird bugs in that part for a platform) Currently I'd say this is the best solution, but I am not sure if this is a big enough problem for this solution. There is no rush though, I still need to figure out how i18n would work for libdiscid bundled for a Windows or Mac OS X program (MusicBrainz Picard does that). I have a rough idea, but nothing tested or implemented. |
jenkins: retest please EDIT: starting by comment still doesn't work, but a manual start failed: |
Meh. Still no final decisions (I'll see how complicated i18n is when everything else works, maybe this is a minor issue compared to other i18n related issues), but right now this doesn't look like something I would implement without actual need. (no current impact/breakage performance problem) |
On 2013-07-29 01:15:17, Johannes Dewender wrote:
pthread is supported on every major platform. Supposedly there is a
There is no need to maintain the file at all. Running aclocal --install --force Apparently the thousand of lines dropped in m4 by gettext and libtool are less of a concern than the m4 file for pthread, so I give up.Sebastian Ramacher |
Sebastian Ramacher wrote at Monday 29 July 2013 09:00:11:
Good to know. I didn't even check Mac and Windows yet since that is meaningless unless we get i18n to work on these.
I think we are talking about different things.
1 and 2 don't have to care about autoconf-archive and additional m4 macros at all. They are either included in the distribution or "already dealt with". This also includes debian packaging. That is possibly also the reason you don't see a problem at all. 3 needs to get the pthread autoconf macro somehow with the proposed changes. Currently these are people willing to test pre-release versions of libdiscid and the continuous integration build server of musicbrainz. The build server, Mac OS X and Windows don't seem to have an easy way to get a current autoconf-archive.
"Äpfel und Birnen.." The macros for gettext and libtool are quite big and make the source distribution (2.) a lot bigger. This is a general autotools problem/feature, but fine. These are macros provided by vanilla autoconf, without additional autoconf-archive needed. All (source distribution) build systems that need autotools (see 3.) have these installed.
as "I should include these in the git repository". Which is a valid option in general, but different from adding m4 macros to the source distribution (automatically). Additionally, both have an actual usage besides performance enhancements (not sure yet if there is an actual performance impact). Again: I still want to thank you for your contribution. It doesn't make everything work out of the box and isn't what's needed most atm, but it is non-trivial code and it is an improvement (when we fix 3. somehow). |
Calling bindtextdomain everytime in discid_new incurs a little overhead. If
pthread is available, we can ensure with pthread_once that bindtextdomain is
called exactly once.
The autoconf function AX_PTHREADS is available from autoconf-archive. In cmake
FIND_LIBRARY(Threads) is used to find pthread.