The MPM may or may not be multithreaded. In the event that it is
multithreaded, at any instant it guarantees a 1:1 mapping of threads
- ap_process_connection invocations. The only primitives the MPM
- provides for synchronization between threads are the ap_thread_mutex
- stuff below.
+ ap_process_connection invocations.
Note: In the future it will be possible for ap_process_connection
to return to the MPM prior to finishing the entire connection; and
used by the connection loop */
API_EXPORT(int) ap_graceful_stop_signalled(void);
-/* a mutex which synchronizes threads within one process */
-typedef struct ap_thread_mutex ap_thread_mutex;
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void);
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *);
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *);
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *);
-
#ifdef HAS_OTHER_CHILD
/*
* register an other_child -- a child which the main loop keeps track of
return NULL;
}
-struct ap_thread_mutex {
- pthread_mutex_t mutex;
-};
-
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void)
-{
- ap_thread_mutex *mtx;
-
- mtx = malloc(sizeof(ap_thread_mutex));
- pthread_mutex_init(&(mtx->mutex), NULL);
- return mtx;
-}
-
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx)
-{
- /* Ignoring error conditions here. :( */
- pthread_mutex_lock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx)
-{
- /* Here too. */
- pthread_mutex_unlock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx)
-{
- /* Here too. */
- pthread_mutex_destroy(&(mtx->mutex));
- free(mtx);
-}
-
-
static const command_rec dexter_cmds[] = {
UNIX_DAEMON_COMMANDS
LISTEN_COMMANDS
return NULL;
}
-struct ap_thread_mutex {
- be_mutex_t mutex;
-};
-
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void)
-{
- ap_thread_mutex *mtx;
-
- mtx = malloc(sizeof(ap_thread_mutex));
- be_mutex_init(&(mtx->mutex), NULL);
- return mtx;
-}
-
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx)
-{
- /* Ignoring error conditions here. :( */
- be_mutex_lock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx)
-{
- /* Here too. */
- be_mutex_unlock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx)
-{
- /* Here too. */
- be_mutex_destroy(&(mtx->mutex));
- free(mtx);
-}
-
-
static const command_rec mpmt_beos_cmds[] = {
UNIX_DAEMON_COMMANDS
LISTEN_COMMANDS
return NULL;
}
-struct ap_thread_mutex {
- pthread_mutex_t mutex;
-};
-
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void)
-{
- ap_thread_mutex *mtx;
-
- mtx = malloc(sizeof(ap_thread_mutex));
- pthread_mutex_init(&(mtx->mutex), NULL);
- return mtx;
-}
-
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx)
-{
- /* Ignoring error conditions here. :( */
- pthread_mutex_lock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx)
-{
- /* Here too. */
- pthread_mutex_unlock(&(mtx->mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx)
-{
- /* Here too. */
- pthread_mutex_destroy(&(mtx->mutex));
- free(mtx);
-}
-
-
static const command_rec mpmt_pthread_cmds[] = {
UNIX_DAEMON_COMMANDS
LISTEN_COMMANDS
return NULL;
}
-/* there are no threads in the prefork model, so the mutexes are
- nops. */
-/* TODO: make these #defines to eliminate the function call */
-
-struct ap_thread_mutex {
- int dummy;
-};
-
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void)
-{
- return malloc(sizeof(ap_thread_mutex));
-}
-
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx)
-{
-}
-
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx)
-{
-}
-
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx)
-{
- free(mtx);
-}
-
/* Stub functions until this MPM supports the connection status API */
API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \
return NULL;
}
-
-struct ap_thread_mutex {
- HMTX mutex_handle;
-};
-
-API_EXPORT(ap_thread_mutex *) ap_thread_mutex_new(void)
-{
- ULONG rc;
- ap_thread_mutex *mutex = malloc(sizeof(ap_thread_mutex));
-
- rc = DosCreateMutexSem(NULL, &mutex->mutex_handle, 0, 0);
- ap_assert(rc == 0);
- return mutex;
-}
-
-API_EXPORT(void) ap_thread_mutex_lock(ap_thread_mutex *mtx)
-{
- ULONG rc;
- rc = DosRequestMutexSem(mtx->mutex_handle, SEM_INDEFINITE_WAIT);
- ap_assert(rc == 0);
-}
-
-API_EXPORT(void) ap_thread_mutex_unlock(ap_thread_mutex *mtx)
-{
- ULONG rc;
- rc = DosReleaseMutexSem(mtx->mutex_handle);
- ap_assert(rc == 0 || rc == ERROR_NOT_OWNER);
-}
-
-API_EXPORT(void) ap_thread_mutex_destroy(ap_thread_mutex *mtx)
-{
- ap_thread_mutex_unlock(mtx);
- DosCloseMutexSem(mtx->mutex_handle);
- free(mtx);
-}
-
/* Stub functions until this MPM supports the connection status API */
API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \