Lines Matching refs:mz

86         motorz_core_t *mz = scon->mz;
88 apr_thread_mutex_lock(mz->mtx);
89 apr_skiplist_remove(mz->timer_ring, &scon->timer, NULL);
90 apr_thread_mutex_unlock(mz->mtx);
184 static apr_status_t motorz_io_user(motorz_core_t *mz, motorz_sb_t *sb)
190 static apr_status_t motorz_io_accept(motorz_core_t *mz, motorz_sb_t *sb)
211 scon->mz = mz;
216 return apr_thread_pool_push(mz->workers,
232 ep->cb(ep->mz, ep->baton);
237 static apr_status_t motorz_timer_event_process(motorz_core_t *mz, motorz_timer_t *te)
242 return apr_thread_pool_push(mz->workers,
264 static apr_status_t motorz_io_event_process(motorz_core_t *mz, motorz_sb_t *sb)
266 return apr_thread_pool_push(mz->workers,
274 motorz_core_t *mz = (motorz_core_t *) baton;
279 status = motorz_io_accept(mz, sb);
282 status = motorz_io_event_process(mz, sb);
285 status = motorz_io_user(mz, sb);
296 motorz_core_t *mz = scon->mz;
302 elem->mz = mz;
304 apr_thread_mutex_lock(mz->mtx);
306 ap_assert(apr_skiplist_insert(mz->timer_ring, elem));
308 apr_skiplist_insert(mz->timer_ring, elem);
310 apr_thread_mutex_unlock(mz->mtx);
316 motorz_core_t *mz;
332 mz = scon->mz;
344 rv = apr_pollset_remove(mz->pollset, &scon->pfd);
396 rv = apr_pollset_add(mz->pollset, &scon->pfd);
432 rv = apr_pollset_add(mz->pollset, &scon->pfd);
448 static apr_status_t motorz_pollset_cb(motorz_core_t *mz, apr_interval_time_t timeout)
454 rc = apr_pollset_poll(mz->pollset, timeout, &num, &out_pfd);
464 motorz_io_callback(mz, out_pfd);
474 static apr_status_t motorz_setup_workers(motorz_core_t *mz)
478 rv = apr_thread_pool_create(&mz->workers,
480 threads_per_child, mz->pool);
492 static int motorz_setup_pollset(motorz_core_t *mz)
500 rv = apr_pollset_create_ex(&mz->pollset,
502 mz->pool,
515 rv = apr_pollset_create(&mz->pollset,
517 mz->pool,
538 static void motorz_note_child_started(motorz_core_t *mz, int slot, pid_t pid)
543 mz->my_generation, slot, MPM_CHILD_STARTED);
569 motorz_core_t *mz = motorz_core_get();
574 if (mz->my_generation !=
589 motorz_core_t *mz = motorz_core_get();
594 if (mz->my_generation !=
624 motorz_core_t *mz = motorz_core_get();
670 *result = mz->my_generation;
709 motorz_core_t *mz = motorz_core_get();
719 mz->is_graceful = (sig == AP_SIG_GRACEFUL_STOP);
727 motorz_core_t *mz = motorz_core_get();
734 mz->is_graceful = (sig == AP_SIG_GRACEFUL);
828 static void child_main(motorz_core_t *mz, int child_num_arg, int child_bucket)
904 apr_skiplist_init(&mz->timer_ring, mz->pool);
905 apr_skiplist_set_compare(mz->timer_ring, timer_comp, timer_comp);
907 status = motorz_setup_workers(mz);
914 status = motorz_setup_pollset(mz);
922 apr_pollfd_t *pfd = apr_pcalloc(mz->pool, sizeof *pfd);
923 motorz_sb_t *sb = apr_pcalloc(mz->pool, sizeof(motorz_sb_t));
928 pfd->p = mz->pool;
942 status = apr_pollset_add(mz->pollset, pfd);
984 apr_thread_mutex_lock(mz->mtx);
985 te = apr_skiplist_peek(mz->timer_ring);
998 apr_thread_mutex_unlock(mz->mtx);
1000 status = motorz_pollset_cb(mz, timeout);
1012 apr_thread_mutex_lock(mz->mtx);
1016 apr_skiplist_pop(mz->timer_ring, NULL);
1017 motorz_timer_event_process(mz, te);
1018 te = apr_skiplist_peek(mz->timer_ring);
1021 apr_thread_mutex_unlock(mz->mtx);
1026 else if (mz->my_generation !=
1038 static int make_child(motorz_core_t *mz, server_rec *s, int slot, int bucket)
1042 if (slot + 1 > mz->max_daemons_limit) {
1043 mz->max_daemons_limit = slot + 1;
1056 motorz_note_child_started(mz, slot, getpid());
1057 child_main(mz, slot, 0);
1116 child_main(mz, slot, bucket);
1120 motorz_note_child_started(mz, slot, pid);
1127 static void startup_children(motorz_core_t *mz, int number_to_start)
1135 if (make_child(mz, ap_server_conf, i, i % num_buckets) < 0) {
1142 static void perform_idle_server_maintenance(motorz_core_t *mz, apr_pool_t *p)
1178 make_child(mz, ap_server_conf, free_slots[0],
1192 motorz_core_t *mz = motorz_core_get();
1196 if (!mz->is_graceful) {
1204 ap_scoreboard_image->global->running_generation = mz->my_generation;
1212 make_child(mz, ap_server_conf, 0, 0);
1242 if (!mz->is_graceful) {
1243 startup_children(mz, remaining_children_to_start);
1287 == mz->my_generation) {
1309 make_child(mz, ap_server_conf, child_slot,
1319 else if (mz->is_graceful) {
1340 startup_children(mz, remaining_children_to_start);
1349 perform_idle_server_maintenance(mz, pconf);
1354 if (shutdown_pending && !mz->is_graceful) {
1384 ap_mpm_pod_killpg(all_buckets[i].pod, mz->max_daemons_limit);
1451 ++mz->my_generation;
1452 ap_scoreboard_image->global->running_generation = mz->my_generation;
1454 if (mz->is_graceful) {
1460 ap_mpm_pod_killpg(all_buckets[i].pod, mz->max_daemons_limit);
1508 motorz_core_t *mz = motorz_core_get();
1512 if (mz->module_loads == 1) {
1527 else if (!mz->is_graceful) { /* Preserve the number of buckets
1569 motorz_core_t *mz;
1589 mz = g_motorz_core = ap_retained_data_get(userdata_key);
1591 mz = g_motorz_core = ap_retained_data_create(userdata_key, sizeof(*g_motorz_core));
1592 mz->max_daemons_limit = -1;
1593 mz->timer_ring = motorz_timer_ring;
1594 mz->pollset = motorz_pollset;
1596 ++mz->module_loads;
1597 if (mz->module_loads == 2) {
1612 apr_pool_create(&mz->pool, ap_pglobal);
1613 apr_pool_tag(mz->pool, "motorz-mpm-core");
1614 apr_skiplist_init(&mz->timer_ring, mz->pool);
1615 apr_skiplist_set_compare(mz->timer_ring, timer_comp, timer_comp);
1616 apr_thread_mutex_create(&mz->mtx, 0, mz->pool);
1633 motorz_core_t *mz = motorz_core_get();
1636 if (mz->module_loads == 1) {
1672 if (!mz->first_server_limit) {
1673 mz->first_server_limit = server_limit;
1675 else if (server_limit != mz->first_server_limit) {
1680 server_limit, mz->first_server_limit);
1681 server_limit = mz->first_server_limit;