If we don't have threads, don't use pthread functions
authoraland <aland>
Mon, 15 Sep 2003 17:12:45 +0000 (17:12 +0000)
committeraland <aland>
Mon, 15 Sep 2003 17:12:45 +0000 (17:12 +0000)
src/modules/rlm_counter/rlm_counter.c

index bbe99ab..c7908b7 100644 (file)
@@ -82,9 +82,22 @@ typedef struct rlm_counter_t {
        time_t last_reset;      /* The time of the last reset. */
        int dict_attr;          /* attribute number for the counter. */
        GDBM_FILE gdbm;         /* The gdbm file handle */
+#ifdef HAVE_PTHREAD_H
        pthread_mutex_t mutex;  /* A mutex to lock the gdbm file for only one reader/writer */
+#endif
 } rlm_counter_t;
 
+#ifndef HAVE_PTHREAD_H
+/*
+ *     This is a lot simpler than putting ifdef's around
+ *     every use of the pthread functions.
+ */
+#define pthread_mutex_lock(a)
+#define pthread_mutex_unlock(a)
+#define pthread_mutex_init(a,b)
+#define pthread_mutex_destroy(a)
+#endif
+
 typedef struct rad_counter {
        unsigned int user_counter;
        char uniqueid[UNIQUEID_MAX_LEN];