From 98eb02c8b054903d2bef17b58734977de6cbc686 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Wed, 14 Jul 2004 02:48:12 +0000 Subject: [PATCH] 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 | 9 +++++++++ platform_unix.c | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/Makefile b/Makefile index 03003c5..c3d9fe5 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ SRCDIR := . platform := macosx use_zlib := true +use_pthread := false ifeq ($(strip $(platform)),macosx) PLATFORMDEF := -DPLATFORM_UNIX -DPLATFORM_MACOSX @@ -23,6 +24,9 @@ endif 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 @@ ifeq ($(strip $(use_zlib)),true) 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) diff --git a/platform_unix.c b/platform_unix.c index c865d20..5f44226 100644 --- a/platform_unix.c +++ b/platform_unix.c @@ -10,7 +10,15 @@ #include #include #include + +/* !!! FIXME: Why aren't we using fork(), anyhow? */ +#if !USE_PTHREAD +#error not implemented yet. +#endif + +#if USE_PTHREAD #include +#endif #include "platform.h" #include "ui.h" @@ -512,6 +520,10 @@ static void *spawn_thread(void *arg) 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 @@ int spawn_xdelta(const char *cmdline) pthread_join(thr, &rc); return(1); /* !!! FIXME *((int *) rc) == 0 ); */ +#endif } /* spawn_xdelta */