MCPcopy Create free account
hub / github.com/acl-dev/acl / thread_main

Function thread_main

lib_acl_cpp/samples/http_request_manager/main.cpp:151–192  ·  view source on GitHub ↗

�̴߳�������

Source from the content-addressed store, hash-verified

149
150// �̴߳�������
151static 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
194static void run(int cocurrent)
195{

Callers

nothing calls this directly

Calls 7

acl_pthread_selfFunction · 0.85
check_all_connectionsFunction · 0.70
http_getFunction · 0.70
peekMethod · 0.45
get_addrMethod · 0.45
resetMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…