X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tests%2Fchild-test.c;h=f7edaee4b31cea391aef67cf47b7fcfff9a59ea8;hb=2a53b4d0e2c98a14aedf31e38f0ad1fb2e8fe26f;hp=b6785728a84a71b85c56966349c69c99aa53918c;hpb=770b29bad2e95f28fda6849e9f9c30560be90cb1;p=platform%2Fupstream%2Fglib.git
diff --git a/tests/child-test.c b/tests/child-test.c
index b678572..f7edaee 100644
--- a/tests/child-test.c
+++ b/tests/child-test.c
@@ -12,9 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*/
/*
@@ -24,16 +22,15 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
-#include "config.h"
-
#include
-#ifdef HAVE_UNISTD_H
-#include
-#endif
#include
#include
+#ifdef G_OS_UNIX
+#include
+#endif
+
#ifdef G_OS_WIN32
#include
#endif
@@ -51,7 +48,7 @@ gint alive;
char *argv0;
#endif
-GPid
+static GPid
get_a_child (gint ttl)
{
GPid pid;
@@ -89,7 +86,7 @@ get_a_child (gint ttl)
#endif /* G_OS_WIN32 */
}
-gboolean
+static gboolean
child_watch_callback (GPid pid, gint status, gpointer data)
{
#ifdef VERBOSE
@@ -163,23 +160,17 @@ main (int argc, char *argv[])
exit (STILL_ACTIVE);
}
#endif
- /* Only run the test, if threads are enabled and a default thread
- * implementation is available.
- */
-#if defined(G_THREADS_ENABLED) && ! defined(G_THREADS_IMPL_NONE)
-#ifdef TEST_THREAD
- g_thread_init (NULL);
-#endif
+
main_loop = g_main_loop_new (NULL, FALSE);
#ifdef G_OS_WIN32
system ("ipconfig /all");
#else
- system ("/bin/true");
+ system ("true");
#endif
alive = 2;
- g_timeout_add (30000, quit_loop, main_loop);
+ g_timeout_add_seconds (30, quit_loop, main_loop);
#ifdef TEST_THREAD
g_thread_create (test_thread, GINT_TO_POINTER (10), FALSE, NULL);
@@ -195,12 +186,13 @@ main (int argc, char *argv[])
g_main_loop_run (main_loop);
+ g_main_loop_unref (main_loop);
+
if (alive > 0)
{
g_warning ("%d children still alive\n", alive);
return 1;
}
-#endif
return 0;
}