Colin requests that we keep this one private for now.
Include it at each point of use (libglib, libgio, tests).
HFILE_GLOB=$(addprefix $(top_srcdir)/glib/,$(shell cat $(top_builddir)/glib/glib-public-headers.txt)) $(top_srcdir)/gmodule/*.h
CFILE_GLOB=$(top_srcdir)/glib/*.c $(top_srcdir)/gmodule/*.c
+# Ignore some private headers
+IGNORE_HFILES = gwakeup.h
+
# Images to copy into HTML directory
HTML_IMAGES = \
file-name-encodings.png \
<xi:include href="xml/bookmarkfile.xml" />
<xi:include href="xml/testing.xml" />
<xi:include href="xml/gunix.xml" />
- <xi:include href="xml/gwakeup.xml" />
<xi:include href="xml/windows.xml" />
</chapter>
<SUBSECTION>
g_hostname_is_ip_address
</SECTION>
-
-<SECTION>
-<FILE>gwakeup</FILE>
-<TITLE>GWakeup</TITLE>
-g_wakeup_new
-g_wakeup_get_pollfd
-g_wakeup_signal
-g_wakeup_acknowledge
-g_wakeup_free
-</SECTION>
gasyncresult.c \
gbufferedinputstream.c \
gbufferedoutputstream.c \
+ ../glib/gwakeup.c \
gcancellable.c \
gcontenttype.c \
gcontenttypeprivate.h \
#include "config.h"
#include "glib.h"
#include <gioerror.h>
+#include "gwakeup.h"
#include "gcancellable.h"
#include "glibintl.h"
gvarianttypeinfo.h \
gvarianttypeinfo.c \
gvarianttype.c \
+ gwakeup.h \
gwakeup.c \
gdebug.h \
gprintf.c \
gutils.h \
gvarianttype.h \
gvariant.h \
- gwakeup.h \
gwin32.h \
gprintf.h
#include <glib/gutils.h>
#include <glib/gvarianttype.h>
#include <glib/gvariant.h>
-#include <glib/gwakeup.h>
#ifdef G_PLATFORM_WIN32
#include <glib/gwin32.h>
#endif
#include "config.h"
+
+/* gwakeup.h is special -- GIO and some test cases include it. As such,
+ * it cannot include other glib headers without triggering the single
+ * includes warnings. We have to manually include its dependencies here
+ * (and at all other use sites).
+ */
+#ifdef GLIB_COMPILATION
+#include "gtypes.h"
+#include "gpoll.h"
+#else
+#include <glib.h>
+#endif
+
#include "gwakeup.h"
/**
/* try eventfd first, if we think we can */
#if defined (HAVE_EVENTFD)
+#ifndef TEST_EVENTFD_FALLBACK
wakeup->fds[0] = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK);
+#else
+ wakeup->fds[0] = -1;
+#endif
if (wakeup->fds[0] != -1)
{
#ifndef __G_WAKEUP_H__
#define __G_WAKEUP_H__
-#include <glib/gtypes.h>
-#include <glib/gpoll.h>
-
typedef struct _GWakeup GWakeup;
-GWakeup * g_wakeup_new (void);
-void g_wakeup_free (GWakeup *wakeup);
+G_GNUC_INTERNAL GWakeup * g_wakeup_new (void);
+G_GNUC_INTERNAL void g_wakeup_free (GWakeup *wakeup);
-void g_wakeup_get_pollfd (GWakeup *wakeup,
- GPollFD *poll_fd);
-void g_wakeup_signal (GWakeup *wakeup);
-void g_wakeup_acknowledge (GWakeup *wakeup);
+G_GNUC_INTERNAL void g_wakeup_get_pollfd (GWakeup *wakeup,
+ GPollFD *poll_fd);
+G_GNUC_INTERNAL void g_wakeup_signal (GWakeup *wakeup);
+G_GNUC_INTERNAL void g_wakeup_acknowledge (GWakeup *wakeup);
#endif
spawn_singlethread_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
TEST_PROGS += gwakeup
+gwakeup_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
gwakeup_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
if HAVE_EVENTFD
TEST_PROGS += gwakeup-fallback
-gwakeup_fallback_SOURCES = gwakeup.c
+gwakeup_fallback_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
gwakeup_fallback_CFLAGS = $(AM_CFLAGS) -DTEST_EVENTFD_FALLBACK
gwakeup_fallback_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
endif
#include <unistd.h>
#include <glib.h>
-
-#ifdef TEST_EVENTFD_FALLBACK
- #include <errno.h>
-
- static gboolean we_broke_eventfd;
-
- /* We interpose over the eventfd() call in the libc to ensure that a
- * failed call to eventfd() gives us a working fallback.
- *
- * We need to do this because older kernel versions don't have eventfd
- * support, and some of them have eventfd but without support for some
- * of the flags we use.
- *
- * We use the we_broke_eventfd boolean to make sure that it actually
- * worked.
- */
- int eventfd (void) {
- we_broke_eventfd = TRUE;
- errno = EINVAL;
-
- return -1;
- }
- #define TESTNAME_SUFFIX "-fallback"
-#else
- #define TESTNAME_SUFFIX ""
-#endif
+#include <glib/gwakeup.h>
#ifdef _WIN32
void alarm (int sec) { }
/* prevent the test from deadlocking */
alarm (30);
-#ifdef TEST_EVENTFD_FALLBACK
- we_broke_eventfd = FALSE;
-#endif
-
wakeup = g_wakeup_new ();
g_assert (!check_signaled (wakeup));
-#ifdef TEST_EVENTFD_FALLBACK
- /* make sure our interposed eventfd call worked */
- g_assert (we_broke_eventfd);
-#endif
-
g_wakeup_signal (wakeup);
g_assert (check_signaled (wakeup));
g_test_init (&argc, &argv, NULL);
+#ifdef TEST_EVENTFD_FALLBACK
+#define TESTNAME_SUFFIX "-fallback"
+#else
+#define TESTNAME_SUFFIX
+#endif
+
+
g_test_add_func ("/gwakeup/semantics" TESTNAME_SUFFIX, test_semantics);
g_test_add_func ("/gwakeup/threaded" TESTNAME_SUFFIX, test_threaded);