| 5 | #include <fcntl.h> |
| 6 | |
| 7 | int main(void) |
| 8 | { |
| 9 | const char* log_file = "mylog.txt"; |
| 10 | logger_open(log_file, "test", NULL); |
| 11 | acl::string buf(81920); |
| 12 | for (int i = 0; i < 81920; i++) |
| 13 | buf << 'X'; |
| 14 | logger(buf.c_str()); |
| 15 | logger_close(); |
| 16 | |
| 17 | acl::fstream fp; |
| 18 | |
| 19 | if (fp.open("test.lock", O_RDWR, 0600) == false) { |
| 20 | printf("open file error\n"); |
| 21 | getchar(); |
| 22 | return (1); |
| 23 | } |
| 24 | |
| 25 | acl::locker locker; |
| 26 | |
| 27 | if (locker.open(fp.file_handle()) == false) { |
| 28 | printf("open lock error\n"); |
| 29 | getchar(); |
| 30 | return (1); |
| 31 | } |
| 32 | if (locker.lock() == true) { |
| 33 | printf("lock ok\n"); |
| 34 | } else { |
| 35 | printf("lock error\n"); |
| 36 | } |
| 37 | |
| 38 | printf("enter any key to exit\n"); |
| 39 | getchar(); |
| 40 | return (0); |
| 41 | } |
| 42 |
nothing calls this directly
no test coverage detected
searching dependent graphs…