�̴߳�������
| 149 | |
| 150 | // �̴߳������� |
| 151 | static void thread_main(void*) |
| 152 | { |
| 153 | for (int i = 0; i < __loop_count; i++) { |
| 154 | http_request_pool* pool = (http_request_pool*) |
| 155 | __conn_manager->peek(); |
| 156 | if (pool == NULL) { |
| 157 | printf("\r\n>>>%lu(%d): peek pool failed<<<\r\n", |
| 158 | (unsigned long) acl_pthread_self(), __LINE__); |
| 159 | check_all_connections(); |
| 160 | exit (1); |
| 161 | } |
| 162 | |
| 163 | // �����ӳ��л�ȡһ�� HTTP ���� |
| 164 | http_request* conn = (http_request*) pool->peek(); |
| 165 | if (conn == NULL) { |
| 166 | printf("\r\n>>>%lu: peek connect failed from %s<<<\r\n", |
| 167 | (unsigned long) acl_pthread_self(), |
| 168 | pool->get_addr()); |
| 169 | check_all_connections(); |
| 170 | exit (1); |
| 171 | } |
| 172 | |
| 173 | // ��Ҫ�Ի�õ���������״̬��������ϴ�������̵���ʱ���� |
| 174 | else { |
| 175 | conn->reset(); |
| 176 | } |
| 177 | |
| 178 | // ��ʼ�µ� HTTP ������� |
| 179 | if (http_get(conn, pool->get_addr(), i) == false) { |
| 180 | printf("one request failed, close connection\r\n"); |
| 181 | // ����������Ҫ�ر� |
| 182 | pool->put(conn, false); |
| 183 | } else { |
| 184 | pool->put(conn, true); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | if (__debug) { |
| 189 | printf(">>>>thread: %lu OVER<<<<\r\n", |
| 190 | (unsigned long) acl_pthread_self()); |
| 191 | } |
| 192 | } |
| 193 | |
| 194 | static void run(int cocurrent) |
| 195 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…