Guest User

Untitled

a guest
Jun 22nd, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. //producer
  2. queue_.push( new_data );// new_data is a 64kb memory range
  3. PostThreadMessage(worker_thread_id_, MyMsg, 0, 0);//notify the worker thread
  4.  
  5. //consumer
  6. while(GetMessage(msg, 0, 0))
  7. {
  8. data = queue_.pop();
  9. WriteFile(file_handle_, data.begin(), data.size(), &io_bytes, NULL);
  10. }
  11.  
  12. //producer
  13. //file must be associated with io completion port
  14. WriteFile( file_handle_
  15. , new_data.begin()
  16. , new_data.size()
  17. , &io_bytes
  18. , new my_overlaped(new_data) );
  19.  
  20. my_completion_key* ck = 0;
  21. my_overlapped* op = 0;
  22. DWORD res = GetQueuedIOCompletionStatus(completion_port_, &io_bytes, &ck, &op);
  23. //process errors
  24. delete op->data;
Add Comment
Please, Sign In to add comment