Now that we have all symbols annotated as GLIB_PUBLIC, we can switch
the build to default to hiding symbols. The major advantage of this
is that it's much harder to accidentally leak symbols.
This patch only adds it to CFLAGS for the sublibraries; we don't want
to affect things like gio/fam, nor the executables.
However, this patch only changes Unix - on Windows, we keep the
.symbols file because we still ultimately need a .def file in order to
generate a .dll.
To unify both Unix and Windows again, we need to do what cairo does
and parse the headers at build time.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
To switch GLib to have private-by-default symbols, we need to have a
macro which expands to G_PUBLIC_API only when compiling a particular
"sublibrary" in GLib (e.g. gmodule, gio).
This patch implements that with a two-level scheme. First, each
sublibrary has its own preprocessor macro e.g. _GTHREAD_API. Then,
the Makefiles are modified to define this to G_PUBLIC_API only when
building that library - so when building libgthread, _GMODULE_API is
left undefined.
Now, we could simply add _G*_API to every entry point, but because
we've already been annotating all the headers with
GLIB_AVAILABLE_IN_XX, let's modify those macros to automatically
depend on a new "_G_API". Then the Makefiles further define _G_API to
the target such as _GTHREAD_API. This indirection avoids a
(glib version)*(sublibrary) explosion of preprocessor definitions in
gversionmacros.h.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
Previously:
* On Unix, an -export-symbol-regex (g_)|(glib_) was used, and the .symbols
files were used in "make check"
* On Windows, the .symbols files are massaged into a format which MSVC
expects as an export list
Now:
* On both Unix and Windows, the .symbols file is used as the list of
symbols to export, and code to generate the exported list per
platform is unified. Even symbols starting with g_ are not exported
unless they are in the file. The abicheck.sh tools are deleted.
https://bugzilla.gnome.org/show_bug.cgi?id=688681
This was turning all the GLIB_VARs in the glib headers into
dllexports on windows, causing all sort of nastiness. libgthread is
mostly empty now anyway, so we don't need any GLIB_COMPILATION like
flag.
g_thread_init() is now a deprecated API, so drop G_DISABLE_DEPRECATED
from the CFLAGS for gthread/. Add the missing declaration for
g_thread_init_with_errorcheck_mutexes() back to deprecated/gthread.h.
And remove the 'joinable' argument from g_thread_new() and
g_thread_new_full().
Change the wording in the docs. Clarify expectations for
(deprecated) g_thread_create().
configure.ac defined G_THREAD_SOURCE and gthread-impl would #include it.
Instead, since we only have two thread implementations now, and since we
always use the Windows one only on Windows, move the logic to the
Makefile, predicated on 'if OS_WIN32'. Then have the chosen backend do
the #include "gthread-impl.c" from there.
Remove the G_THREAD_SOURCE define from configure.ac.
The translation of GLib priorities into the thread priorities of
different operating systems belongs in the implementation -- not
half-way in the front end.
g_thread_gettime() is an undocumented public function pointer that
points to a function that returns the monotonic time in nanoseconds.
g_get_monotonic_time() does the same in microseconds, so it can be used
instead.
GLib had one internal user in GFileMonitor that only cared about
millisecond accuracy; it has been ported to g_get_monotonic_time().
G_THREADS_ENABLED still exists, but is always defined. It is still
possible to use libglib without threads, but gobject (and everything
above it) is now guaranteed to be using threads (as, in fact, it was
before, since it was accidentally impossible to compile with
--disable-threads).
https://bugzilla.gnome.org/show_bug.cgi?id=616754
We need to test the case of eventfd in the libc but no kernel support.
In order to do that, we add a separate compile of the GWakeup testcase
that interposes an 'eventfd' symbol that always returns -1 with errno
set. That will trigger the fallback case.
This new API allows watching a few select Unix signals;
looking through the list on my system, I didn't see anything
else that I think it'd reasonable to watch.
We build on the previous patch to make the child watch helper thread
that existed on Unix handle these signals in the threaded case.
In the non-threaded case, they're just global variables.
https://bugzilla.gnome.org/show_bug.cgi?id=644941