���̴߳�������
| 103 | |
| 104 | // ���̴߳������� |
| 105 | static void thread_main(void*) |
| 106 | { |
| 107 | for (int i = 0; i < __loop_count; i++) { |
| 108 | connect_pool* pool = (connect_pool*) __conn_manager->peek(); |
| 109 | if (pool == NULL) { |
| 110 | printf("\r\n>>>%lu(%d): peek pool failed<<<\r\n", |
| 111 | (unsigned long) acl_pthread_self(), __LINE__); |
| 112 | check_all_connections(); |
| 113 | break; |
| 114 | } |
| 115 | |
| 116 | // �������ӵij�ʱʱ�估����ʱʱ�� |
| 117 | pool->set_timeout(2, 2); |
| 118 | |
| 119 | // �����ӳ��л�ȡһ������ |
| 120 | connect_client* conn = (connect_client*) pool->peek(); |
| 121 | if (conn == NULL) { |
| 122 | printf("\r\n>>>%lu: peek connect failed from %s<<<\r\n", |
| 123 | (unsigned long) acl_pthread_self(), |
| 124 | pool->get_addr()); |
| 125 | check_all_connections(); |
| 126 | break; |
| 127 | } |
| 128 | |
| 129 | // ��Ҫ�Ի�õ���������״̬��������ϴ�������̵���ʱ���� |
| 130 | else { |
| 131 | conn->reset(); |
| 132 | } |
| 133 | |
| 134 | // ��ʼ�µ� HTTP ������� |
| 135 | if (get(conn, i) == false) { |
| 136 | printf("one request failed, close connection\r\n"); |
| 137 | // ����������Ҫ�ر� |
| 138 | pool->put(conn, false); |
| 139 | } else { |
| 140 | pool->put(conn, true); |
| 141 | } |
| 142 | } |
| 143 | |
| 144 | printf(">>>>thread: %lu OVER<<<<\r\n", (unsigned long) acl_pthread_self()); |
| 145 | } |
| 146 | |
| 147 | static void run(int cocurrent, int delay) |
| 148 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…