Note that there are some explanatory texts on larger screens.

plurals
  1. USMarco Pagliaricci
    primarykey
    data
    text
    plurals
    1. COI indeed never deallocate the stream until all operations pending are completed. Since I do only 1 operation each time, I have 2 flags: pending read, and pending write, so when i have 00==no pending operations, 11==pending both write and reading, 01==pending read, and so on. I set the flag on before calling ReadFile() and I set it off in the iocp handler. Here I don't need atomic flags, nor atomic counters because I perform only 1 operation, correct?
      singulars
    2. COIf the packet is pending, I'll do that on the iocp handler, if its not pending anymore, and not used anymore, I must deallocate it from the Stream's dtor, or it will leak a packet. Now the problem is that I don't know if I need some atomic counter (or even a boleean value) which simply tells me *atomically* that the packet is not pending anymore, no other threads has any kind of ownership on it, so I can delete it from Stream's dtor. Someone say that I do not need atomicity here, but is that true? I'm a bit doubtful here.
      singulars
    3. COThanks Len. Well, I have a general purpose framework here, so I don't need to expose io requests packets to the user, instead I want to hide them. With the normal design of (A) taking an io req. packet from a pool and (B) put it back on the pool from the iocp handler thread would indeed brings a new bottleneck: the locking of the pool. My aim here is to keep the same io req. packet, until the life of the connection, so until the life of the Stream object. Now the only concern I have is *when* I have to deallocate the io req. packet, inside Stream's dtor, or inside iocp handler?
      singulars
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload