| 123 | }; |
| 124 | |
| 125 | static 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 | |
| 175 | static void usage(const char* proc) |
| 176 | { |
nothing calls this directly
no test coverage detected
searching dependent graphs…