Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 8th, 2008, 11:05 AM
patricerolland
Guest
 
Posts: n/a
Default pipe blocked

hi all, how can i detect that a pipe is frozen in c++ ? I mean if for
example the application that receives the pipe has a problem ? my code
belowed :

if (! CreatePipe(&hChildStdinRd, &poempdev->hChildStdinWr, &saAttr,
0))
ERR(ERRORTEXT("Error %d :Stdin pipe creation failed.\r
\n"),GetLastError());

if (!WriteFile(poempdev->hChildStdinWr, szBuf, cbBuffer, &poempdev-
Quote:
>dwResult, NULL))
tks in advance
Patrice Rolland
  #2  
Old July 8th, 2008, 01:25 PM
Victor Bazarov
Guest
 
Posts: n/a
Default Re: pipe blocked

patricerolland wrote:
Quote:
hi all, how can i detect that a pipe is frozen in c++ ? I mean if for
example the application that receives the pipe has a problem ? my code
belowed :
>
if (! CreatePipe(&hChildStdinRd, &poempdev->hChildStdinWr, &saAttr,
0))
ERR(ERRORTEXT("Error %d :Stdin pipe creation failed.\r
\n"),GetLastError());
>
if (!WriteFile(poempdev->hChildStdinWr, szBuf, cbBuffer, &poempdev-
Quote:
>dwResult, NULL))
>
tks in advance
Patrice Rolland
A single thread cannot detect whether it has been blocked by I/O. You
would need a second thread and an event common for both. Decide on the
timeout for the event, spin off the second thread, let it wait for the
event. The I/O thread should only set the event after I/O is complete.
The second thread will wait for the event, and if it times out, cancel
the I/O operation (don't ask how, it's not specific to C++).

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles