}
}
-#ifdef HAVE_PTHREAD_H
(void) pthread_mutex_init(&inst->worker_mutex, NULL);
-#endif
return 0;
}
{
proto_detail_t *inst = talloc_get_type_abort(instance, proto_detail_t);
-#ifdef HAVE_PTHREAD_H
pthread_mutex_destroy(&inst->worker_mutex);
-#endif
return 0;
}
fr_listen_t *listen; //!< The listener structure which describes
//!< the I/O path.
-#ifdef HAVE_PTHREAD_H
pthread_mutex_t worker_mutex; //!< for the workers
-#endif
int num_workers; //!< number of workers
} proto_detail_t;
rlm_components_t send_type;
} proto_detail_process_t;
-#ifdef HAVE_PTHREAD_H
#include <pthread.h>
-#define PTHREAD_MUTEX_LOCK pthread_mutex_lock
-#define PTHREAD_MUTEX_UNLOCK pthread_mutex_unlock
-
-#else
-#define PTHREAD_MUTEX_LOCK
-#define PTHREAD_MUTEX_UNLOCK
-#endif
#ifdef __cplusplus
}
proto_detail_file_t *inst = talloc_get_type_abort(li->thread_instance, proto_detail_file_t);
bool has_worker = false;
- PTHREAD_MUTEX_LOCK(&inst->parent->worker_mutex);
+ pthread_mutex_lock(&inst->parent->worker_mutex);
has_worker = (inst->parent->num_workers != 0);
- PTHREAD_MUTEX_UNLOCK(&inst->parent->worker_mutex);
+ pthread_mutex_unlock(&inst->parent->worker_mutex);
if (has_worker) return;
li->default_message_size = inst->parent->max_packet_size;
li->num_messages = inst->parent->num_messages;
- PTHREAD_MUTEX_LOCK(&inst->parent->worker_mutex);
+ pthread_mutex_lock(&inst->parent->worker_mutex);
inst->parent->num_workers++;
- PTHREAD_MUTEX_UNLOCK(&inst->parent->worker_mutex);
+ pthread_mutex_unlock(&inst->parent->worker_mutex);
/*
* Instantiate the new worker.
int fd, rcode;
bool has_worker;
- PTHREAD_MUTEX_LOCK(&inst->parent->worker_mutex);
+ pthread_mutex_lock(&inst->parent->worker_mutex);
has_worker = (inst->parent->num_workers != 0);
- PTHREAD_MUTEX_UNLOCK(&inst->parent->worker_mutex);
+ pthread_mutex_unlock(&inst->parent->worker_mutex);
/*
* The worker is still processing the file, poll until
* hacks in proto_detail which let us start up with
* "transport = work" for debugging purposes.
*/
- PTHREAD_MUTEX_LOCK(&inst->parent->worker_mutex);
+ pthread_mutex_lock(&inst->parent->worker_mutex);
inst->parent->work_io_instance = NULL;
if (inst->parent->num_workers > 0) inst->parent->num_workers--;
- PTHREAD_MUTEX_UNLOCK(&inst->parent->worker_mutex);
+ pthread_mutex_unlock(&inst->parent->worker_mutex);
DEBUG("Closing and deleting detail worker file %s", inst->name);