| 662 | #endif |
| 663 | |
| 664 | static apr_status_t dbd_setup_init(apr_pool_t *pool, server_rec *s) |
| 665 | { |
| 666 | dbd_group_t *group; |
| 667 | apr_status_t rv = APR_SUCCESS; |
| 668 | |
| 669 | for (group = group_list; group; group = group->next) { |
| 670 | apr_status_t rv2; |
| 671 | |
| 672 | rv2 = apr_pool_create(&group->pool, pool); |
| 673 | if (rv2 != APR_SUCCESS) { |
| 674 | ap_log_error(APLOG_MARK, APLOG_CRIT, rv2, s, APLOGNO(00634) |
| 675 | "Failed to create reslist cleanup memory pool"); |
| 676 | return rv2; |
| 677 | } |
| 678 | apr_pool_tag(group->pool, "dbd_group"); |
| 679 | |
| 680 | #if APR_HAS_THREADS |
| 681 | rv2 = dbd_setup(s, group); |
| 682 | if (rv2 == APR_SUCCESS) { |
| 683 | continue; |
| 684 | } |
| 685 | else if (rv == APR_SUCCESS) { |
| 686 | rv = rv2; |
| 687 | } |
| 688 | |
| 689 | /* we failed, so create a mutex so that subsequent competing callers |
| 690 | * to ap_dbd_open can serialize themselves while they retry |
| 691 | */ |
| 692 | rv2 = apr_thread_mutex_create(&group->mutex, |
| 693 | APR_THREAD_MUTEX_DEFAULT, pool); |
| 694 | if (rv2 != APR_SUCCESS) { |
| 695 | ap_log_error(APLOG_MARK, APLOG_CRIT, rv2, s, APLOGNO(00635) |
| 696 | "Failed to create thread mutex"); |
| 697 | return rv2; |
| 698 | } |
| 699 | #endif |
| 700 | } |
| 701 | |
| 702 | return rv; |
| 703 | } |
| 704 | |
| 705 | static void dbd_child_init(apr_pool_t *p, server_rec *s) |
| 706 | { |
no test coverage detected