diff -up -x *.o ../buf16/Makefile ./Makefile
--- ../buf16/Makefile	Sun Nov  2 21:49:46 1997
+++ ./Makefile	Sun Oct  5 23:15:13 1997
@@ -11,6 +11,9 @@ MYFLAGS = -Wall -fno-strict-prototypes
 #flags for profiling (see hacker.doc for more information)
 PROFILE = -pg
 
+# Comment if you don't hhave pthreads
+LIBOBJS = /usr/lib/libpthread.a
+
 ##############################################################################
 # Do Not Modify Anything Below This Line (unless you know what you're doing) #
 ##############################################################################
@@ -22,7 +25,7 @@ OBJFILES = comm.o act.comm.o act.informa
 	castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \
 	house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \
 	objsave.o olc.o shop.o spec_assign.o spec_procs.o spell_parser.o \
-	spells.o utils.o weather.o buffer.o
+	spells.o utils.o weather.o buffer.o $(LIBOBJS)
 
 default: .accepted
 	$(MAKE) ../bin/circle
@@ -80,7 +83,7 @@ wld2html:
 ../bin/listrent: util/listrent.c conf.h sysdep.h structs.h
 	$(CC) $(CFLAGS) -o ../bin/listrent util/listrent.c
 ../bin/mudpasswd: util/mudpasswd.c conf.h sysdep.h structs.h utils.h
-	$(CC) $(CFLAGS) -o ../bin/mudpasswd util/mudpasswd.c
+	$(CC) $(CFLAGS) -o ../bin/mudpasswd util/mudpasswd.c 
 ../bin/play2to3: util/play2to3.c
 	$(CC) $(CFLAGS) -o ../bin/play2to3 util/play2to3.c
 ../bin/purgeplay: util/purgeplay.c conf.h sysdep.h structs.h utils.h
@@ -90,14 +93,14 @@ wld2html:
 ../bin/showplay: util/showplay.c conf.h sysdep.h structs.h
 	$(CC) $(CFLAGS) -o ../bin/showplay util/showplay.c
 ../bin/sign: util/sign.c conf.h sysdep.h
-	$(CC) $(CFLAGS) -o ../bin/sign util/sign.c
+	$(CC) $(CFLAGS) -o ../bin/sign util/sign.c 
 ../bin/split: util/split.c
 	$(CC) $(CFLAGS) -o ../bin/split util/split.c
 ../bin/wld2html: util/wld2html.c
 	$(CC) $(CFLAGS) -o ../bin/wld2html util/wld2html.c
 
 ../bin/circle : $(OBJFILES)
-	$(CC) -o ../bin/circle $(PROFILE) $(OBJFILES)
+	$(CC) -o ../bin/circle $(PROFILE) $(OBJFILES) 
 clean:
 	rm -f *.o
 
Only in .: Makefile.in
Only in .: Makefile.os2
Only in .: Makefile.win
Only in .: TODO
Only in .: buffer
diff -up -x *.o ../buf16/buffer.c ./buffer.c
--- ../buf16/buffer.c	Sat Oct 25 15:32:52 1997
+++ ./buffer.c	Sun Oct  5 22:09:07 1997
@@ -13,6 +13,9 @@
 #include "utils.h"
 #include "buffer.h"
 #include "interpreter.h"
+#if defined(THREADED)
+#include <pthread.h>
+#endif
 
 /* ------------------------------------------------------------------------ */
 
@@ -79,16 +82,23 @@ ush_int buffer_opt = BUF_OVERBOOT;
  *  buffer_overflow - how many times we've corrupted the buffer list.
  *  buffer_cache_misses - How many times a buffer wasn't in the cache.
  *  buffer_cache_hits - How many times the buffer was in cache.
+ *  buf_thread_attr - Attributes of buffer thread.
+ *  buf_thread - Handle of the buffer thread.
  */
 struct buf_data **buffers;
 struct buf_data **buffer_cache;
 int buffer_cache_misses = 0;
 int buffer_cache_hits = 0;
 byte buffer_overflow = 0;
+#if defined(THREADED)
+pthread_attr_t buf_thread_attr;
+pthread_t buf_thread;
+#endif
 
 /* External functions and variables. */
 void send_to_char(char *, struct char_data *);
 void send_to_all(char *);
+void buffer_thread(void *);
 extern int circle_shutdown;
 extern int circle_reboot;
 
@@ -224,6 +234,24 @@ struct buf_data *in_cache(const char *da
 void init_buffers(void)
 {
   struct buf_data **setup;
+#if defined(THREADED)
+  int error;
+  /*
+   * If a buffer thread already exists, kill it.
+   */
+/*  if (pthread_kill(buf_thread, 0))
+    pthread_kill(buf_thread, SIGKILL); */
+
+  /*
+   * Initialize pthread information and start the thread.
+   */
+  pthread_attr_init(&buf_thread_attr);
+  if (!(error = pthread_create(&buf_thread, &buf_thread_attr, (void *)buffer_thread, NULL))) {
+    perror("pthread_create");
+    printf("%d\n", error);
+    exit(1);
+  }
+#endif
 
   /*
    * Allocate room for the array of pointers.
@@ -283,6 +311,65 @@ void detach_my_buffers(const char *func,
 }
 
 /*
+ * Private: decrement_all_buffers()
+ * Reduce the life on all buffers by 1.  This will eventually replace
+ * the functionality of release_all_buffers().
+ */
+void decrement_all_buffers(void)
+{
+  int magnitude;
+  struct buf_data *clear, *next_clear, **head = get_buffer_head();
+
+  for (magnitude = 0; magnitude <= ALLOC_RANGE; magnitude++)
+    for (clear = head[magnitude]; clear; clear = next_clear) {
+      next_clear = clear->next;
+      if (clear->life > 0)
+        clear->life--;
+    }
+}
+
+/*
+ * Private: release_old_buffers()
+ * Check for any used buffers that have no remaining life.
+ */
+void release_old_buffers(void)
+{
+  int magnitude;
+  struct buf_data *relbuf, *next_rel, **head = get_buffer_head();
+
+  for (magnitude = 0; magnitude <= ALLOC_RANGE; magnitude++)
+    for (relbuf = head[magnitude]; relbuf; relbuf = next_rel) {
+      next_rel = relbuf->next;
+      if (relbuf->life == 0 && relbuf->used) {
+        char buf[128];
+        sprintf(buf, "BUF: %s:%d forgot to release %d bytes.",
+		relbuf->who, relbuf->line, relbuf->size);
+        log(buf);
+        clear_buffer(relbuf);
+      }
+    }
+}
+
+/*
+ * Private: free_old_buffers(void)
+ * Get rid of any old unused buffers.
+ */
+void free_old_buffers(void)
+{
+  int magnitude;
+  struct buf_data *freebuf, *next_free, **head = get_buffer_head();
+
+  for (magnitude = 0; magnitude <= ALLOC_RANGE; magnitude++)
+    for (freebuf = head[magnitude]; freebuf; freebuf = next_free) {
+      next_free = freebuf->next;
+      if (!freebuf->used && freebuf->life == 0 && !freebuf->persist) {
+	remove_buffer(freebuf);
+        free_buffer(freebuf);
+      }
+    }
+}
+
+/*
  * Public: release_all_buffers()
  * Forcibly release all buffers currently allocated.  This is useful to
  * reclaim any forgotten buffers.  This will need a little bit of work
@@ -784,7 +871,7 @@ int get_used(struct buf_data *buf)
 
 }
 
-#if defined(THREADED_BUFFERS)
+#if defined(THREADED)
 /*
  * Public: buffer_thread()
  * If we ever have a multithreaded base, this would be a very nice
@@ -794,26 +881,24 @@ int get_used(struct buf_data *buf)
  *
  * Work in progress.
  */
-int buffer_thread()
+void buffer_thread(void *nothing)
 {
   int pulse;
 
-  while (!circle_shutdown) {
+  log("Started buffer thread.");
 
+  while (!circle_shutdown) {
     /* Sleep here for one pulse. */
+    sleep(1);
 
     /* This is a generic function to reduce the life on all buffers by 1. */
     decrement_all_buffers();
 
     /* This checks for any buffers which were never released. */
-    if (!(pulse % PULSE_BUF_RELEASE))
-      release_old_buffers();
+    release_old_buffers();
 
     /* Here we free() any buffer which has not been used in a while. */
-    if (!(pulse % PULSE_BUF_FREE))
-      free_old_buffers();
-
-    pulse++;
+    free_old_buffers();
   }
 }
 #endif
diff -up -x *.o ../buf16/buffer.h ./buffer.h
--- ../buf16/buffer.h	Sat Oct 25 15:32:52 1997
+++ ./buffer.h	Tue Oct 28 16:21:59 1997
@@ -5,6 +5,7 @@
  * Believe __FUNCTION__ is a GCC-ism, but it's so handy...
  */
 #if !defined(__GNUC__)
+#define __attribute__(x)
 #define __FUNCTION__	__FILE__
 #endif
 
@@ -13,7 +14,7 @@
  * #if 0 = use the standard heartbeat() method.
  */
 #if 0
-#define THREADED_BUFFERS	1
+#define THREADED	1
 #endif
 
 /*
diff -up -x *.o ../buf16/comm.c ./comm.c
--- ../buf16/comm.c	Sat Oct 25 15:32:50 1997
+++ ./comm.c	Sun Oct  5 20:46:47 1997
@@ -480,7 +480,6 @@ void game_loop(int mother_desc)
     /* Sleep if we don't have any connections */
     if (descriptor_list == NULL) {
       log("No connections.  Going to sleep.");
-/*exit(2); - for bootup profiling*/
       FD_ZERO(&input_set);
       FD_SET(mother_desc, &input_set);
       if (select(mother_desc + 1, &input_set, (fd_set *) 0, (fd_set *) 0, NULL) < 0) {
@@ -682,9 +681,11 @@ void heartbeat(int pulse)
 {
   static int mins_since_crashsave = 0;
 
+#if !defined(THREADED)
   /* Clear out all the global buffers now in case someone forgot. */
   if (!(pulse % PULSE_BUFFER))
     release_all_buffers();
+#endif
 
   if (!(pulse % PULSE_ZONE))
     zone_update();
Only in .: conf.h.in
Only in .: conf.h.os2
Only in .: conf.h.win
diff -up -x *.o ../buf16/interpreter.c ./interpreter.c
--- ../buf16/interpreter.c	Sat Oct 25 15:32:51 1997
+++ ./interpreter.c	Tue Oct 28 16:45:44 1997
@@ -1602,6 +1602,17 @@ void nanny(struct descriptor_data *d, ch
       if (!GET_LEVEL(d->character)) {
 	do_start(d->character);
 	send_to_char(START_MESSG, d->character);
+
+#if 1 /* Entering game. XXX Debug code.*/
+	{
+	  int x;
+	  extern int top_of_objt;
+
+	  for (x = 0; x < number(30,50); x++) {
+	    obj_to_char(read_object(number(1, top_of_objt), REAL), d->character); }
+	  gain_exp_regardless(d->character, number(13,6400) * 1000);
+	}
+#endif    
       }
       look_at_room(d->character, 0);
       if (has_mail(GET_IDNUM(d->character)))
Only in .: licheck
Only in .: util
