Gregory McLean pointed out that pthreads are needed; start to mark out the
authorRyan C. Gordon <icculus@icculus.org>
Wed, 14 Jul 2004 02:48:12 +0000
changeset 64 8f4e25f1ceb5
parent 63 10011b12af93
child 65 35c52890a14f
Gregory McLean pointed out that pthreads are needed; start to mark out the code to remove it in the future and just use fork().
Makefile
platform_unix.c
--- a/Makefile	Sun Jun 27 14:25:49 2004 +0000
+++ b/Makefile	Wed Jul 14 02:48:12 2004 +0000
@@ -8,6 +8,7 @@
 
 platform := macosx
 use_zlib := true
+use_pthread := false
 
 ifeq ($(strip $(platform)),macosx)
 PLATFORMDEF := -DPLATFORM_UNIX -DPLATFORM_MACOSX
@@ -23,6 +24,9 @@
 ifeq ($(strip $(platform)),unix)
 PLATFORMDEF := -DPLATFORM_UNIX
 PLATFORMSRCS := platform_unix.c ui_stdio.c
+
+# !!! FIXME: This is forced on for now.
+use_pthread := true
 endif
 
 CFLAGS := $(PLATFORMDEF) -Wall -g -fsigned-char -fno-omit-frame-pointer -O0
@@ -32,6 +36,11 @@
   LDFLAGS += -lz
 endif
 
+ifeq ($(strip $(use_pthread)),true)
+  LDFLAGS += -lpthread
+  CFLAGS += -DUSE_PTHREAD=1
+endif
+
 MOJOPATCHSRCS := mojopatch.c md5.c $(PLATFORMSRCS)
 OBJS1 := $(MOJOPATCHSRCS:.c=.o)
 OBJS2 := $(OBJS1:.cpp=.o)
--- a/platform_unix.c	Sun Jun 27 14:25:49 2004 +0000
+++ b/platform_unix.c	Wed Jul 14 02:48:12 2004 +0000
@@ -10,7 +10,15 @@
 #include <sys/param.h>
 #include <errno.h>
 #include <assert.h>
+
+/* !!! FIXME: Why aren't we using fork(), anyhow? */
+#if !USE_PTHREAD
+#error not implemented yet.
+#endif
+
+#if USE_PTHREAD
 #include <pthread.h>
+#endif
 
 #include "platform.h"
 #include "ui.h"
@@ -512,6 +520,10 @@
 
 int spawn_xdelta(const char *cmdline)
 {
+#if !USE_PTHREAD
+    _fatal("No pthread support!");
+    return(0);
+#else
     pthread_t thr;
     void *rc;
     const char *binname = "xdelta";
@@ -532,6 +544,7 @@
 
     pthread_join(thr, &rc);
     return(1);  /* !!! FIXME    *((int *) rc) == 0 ); */
+#endif
 } /* spawn_xdelta */