ֻд��ʽ�����ļ�
| 39 | |
| 40 | // ֻд��ʽ�����ļ� |
| 41 | bool open_write() |
| 42 | { |
| 43 | fp_ = new acl::aio_fstream(handle_); |
| 44 | filepath_.format("%s/%lu_%d_%d", path_.c_str(), |
| 45 | (unsigned long) acl_pthread_self(), ibegin_, ifile_++); |
| 46 | if (fp_->open_write(filepath_.c_str()) == false) |
| 47 | { |
| 48 | printf("open file %s error: %s\r\n", |
| 49 | filepath_.c_str(), acl::last_serror()); |
| 50 | return false; |
| 51 | } |
| 52 | |
| 53 | // ����д�ɹ��Ļص����� |
| 54 | fp_->add_write_callback(this); |
| 55 | |
| 56 | // ���ӹرյĻص����� |
| 57 | fp_->add_close_callback(this); |
| 58 | |
| 59 | // 1 ���������� |
| 60 | fp_->write(__data, sizeof(__data), delay_ * 1000000); |
| 61 | return true; |
| 62 | } |
| 63 | protected: |
| 64 | bool read_callback(char*, int) |
| 65 | { |