[PATCH 10/10] timegm: add portable implementation (Solaris support)
Blake Jones
blakej at foo.net
Sun Nov 4 07:40:50 PST 2012
Hi Jani,
> I'd prefer to use timegm() where available, and the suggested
> alternative [1] elsewhere.
>
> [1] http://www.kernel.org/doc/man-pages/online/pages/man3/timegm.3.html
I considered this alternative, but decided against it because it's
completely MT-unsafe. I don't know whether libnotmuch itself is
MT-safe, but a process which called this routine in one thread would
temporarily throw off any timezone-related work that any other threads
were doing, even if they weren't using libnotmuch.
> I'll look into the compat build issues when I have a moment.
If you do, here's a boiled-down version of the problem that I came up
with while investigating it:
$ echo 'int main() { extern int foo1(); return foo1(); }' > main.c
$ echo 'int foo1() { extern int bar(); return bar(); }' > foo1.c
$ echo 'int bar() { extern int foo2(); return foo2(); }' > bar.c
$ echo 'int foo2() { return 0; }' > foo2.c
$ gcc -c main.c foo1.c bar.c foo2.c
$ ar rcs libfoo.a foo1.o foo2.o
$ ar rcs libbar.a bar.o
$ gcc -o main main.o libfoo.a libbar.a
[fails]
$ gcc -o main main.o libbar.a libfoo.a
[fails]
Another alternative would be to just include parse-time-string.o in
libnotmuch.a directly; I think that would solve the problem.
Blake
More information about the notmuch
mailing list