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

Function thread_main

lib_acl_cpp/samples/fs_benchmark/fs_benchmark.cpp:125–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123};
124
125static void thread_main(void*)
126{
127 printf("%s: thread: %ld\r\n", __FUNCTION__,
128 (unsigned long) acl_pthread_self());
129 acl::aio_handle* handle;
130
131 // ÿ���̴߳����������첽�¼����
132 handle = new acl::aio_handle(__kernel_event ?
133 acl::ENGINE_KERNEL : acl::ENGINE_SELECT);
134
135 int i;
136 for (i = 0; i < __parallel; i++)
137 {
138 async_file* fp = new async_file(handle, __path, i);
139 if (fp->open_write() == false)
140 {
141 printf("open file error: %s\r\n", acl::last_serror());
142 delete fp;
143 break;
144 }
145 }
146
147 if (i == 0)
148 {
149 printf("thread(%lu) no file opened!\r\n", (unsigned long)
150 acl_pthread_self());
151 delete handle;
152 return;
153 }
154
155 // �����첽�¼�ѭ������
156 while (true)
157 {
158 if (handle->check() == false)
159 break;
160 if (__nok == __parallel)
161 {
162 printf("%s: thread(%lu) over, total: %d\r\n", __FUNCTION__,
163 (unsigned long) acl_pthread_self(), __nok);
164 break;
165 }
166 }
167
168 // ��Ϊ IO ������ӳ��ͷŵģ�������Ҫ�ٴμ��һ��
169 handle->check();
170
171 // �����첽�¼����
172 delete handle;
173}
174
175static void usage(const char* proc)
176{

Callers

nothing calls this directly

Calls 4

acl_pthread_selfFunction · 0.85
last_serrorFunction · 0.50
open_writeMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…