Advertisement
rnort

SPO-5-LIB

Nov 23rd, 2012
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <aio.h>
  3. #include <errno.h>
  4. #include <string.h>
  5. #include <stdlib.h>
  6.  
  7. int AReadF(struct aiocb *aiocbp)
  8. {
  9.     int ind;
  10.     ind=aio_read(aiocbp);
  11.    
  12.     ind=aio_error(aiocbp);
  13.     struct aiocb **list = (struct aiocb**) calloc (1, sizeof (struct aiocb*));
  14.     list[0] = aiocbp;
  15.     ind = aio_suspend (list, 1, 0);
  16.     printf ("Read buf len = %d\n",  strlen((char*)aiocbp->aio_buf));
  17.    
  18.     return strlen((char*)aiocbp->aio_buf);
  19. }
  20.  
  21. int AWriteF(struct aiocb *aiocbp)
  22. {
  23.     int ind;
  24.     ind=aio_write(aiocbp);
  25.  
  26.     ind=aio_error(aiocbp);
  27.     printf("Write progress ind=%d\n",ind);
  28.  
  29.     struct aiocb **list = (struct aiocb**) calloc (1, sizeof (struct aiocb*));
  30.     list[0] = aiocbp;
  31.     ind = aio_suspend (list, 1, 0);
  32.    
  33.     return strlen((char*)aiocbp->aio_buf);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement