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

Function thread_main

lib_acl_cpp/samples/http_request_pool/main.cpp:83–106  ·  view source on GitHub ↗

�̴߳�������

Source from the content-addressed store, hash-verified

81
82// �̴߳�������
83static void thread_main(void*)
84{
85 for (int i = 0; i < __loop_count; i++) {
86 // �����ӳ��л�ȡһ�� HTTP ����
87 http_request* conn = (http_request*) __conn_pool->peek();
88 if (conn == NULL) {
89 printf("peek connect failed\r\n");
90 break;
91 }
92
93 // ��Ҫ�Ի�õ���������״̬��������ϴ�������̵���ʱ����
94 else {
95 conn->reset();
96 }
97 // ��ʼ�µ� HTTP �������
98 if (http_get(conn, i) == false) {
99 printf("one request failed, close connection\r\n");
100 // ����������Ҫ�ر�
101 __conn_pool->put(conn, false);
102 } else {
103 __conn_pool->put(conn, true);
104 }
105 }
106}
107
108static void run(int cocurrent)
109{

Callers

nothing calls this directly

Calls 4

http_getFunction · 0.70
peekMethod · 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…