Skip to content

Commit

Permalink
Gregory McLean pointed out that pthreads are needed; start to mark ou…
Browse files Browse the repository at this point in the history
…t the

code to remove it in the future and just use fork().
  • Loading branch information
icculus committed Jul 14, 2004
1 parent 33f6cd8 commit 98eb02c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Makefile
Expand Up @@ -8,6 +8,7 @@ SRCDIR := .

platform := macosx
use_zlib := true
use_pthread := false

ifeq ($(strip $(platform)),macosx)
PLATFORMDEF := -DPLATFORM_UNIX -DPLATFORM_MACOSX
Expand All @@ -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
Expand All @@ -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)
Expand Down
13 changes: 13 additions & 0 deletions platform_unix.c
Expand Up @@ -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"
Expand Down Expand Up @@ -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";
Expand All @@ -532,6 +544,7 @@ int spawn_xdelta(const char *cmdline)

pthread_join(thr, &rc);
return(1); /* !!! FIXME *((int *) rc) == 0 ); */
#endif
} /* spawn_xdelta */


Expand Down

0 comments on commit 98eb02c

Please sign in to comment.