Question for Chris Tacke regaring CEPorts class

  • Thread starter Thread starter jayderk
  • Start date Start date
J

jayderk

I was playing with the code a bit and was wondering if you had any
suggestions on how to fix this problem I am having.

first... I have the mainForm start a seperate thread that opens the comm
port. It then goes in to a while loop (that calles CEAPI.ReadFile) until a
condition is met.. it then exits the while loop closes the
connection(CloseHandle) and the thread terminates.

I seperated out the createFile and CloseHandle methods so I can leave the
comm port open.

I notice it sits at CEAPI.ReadFile for a long time..
My question> is there a SAFE way to close the connection and kill the thread
while it is sitting at CEAPI.ReadFile? It says in Microsoft Core Reference
the Abort is not supported in the CF.

thanks in advance
Jay
 
While you can not "abort" the ReadFile call, you should be able to call
CloseHandle on the file handle you are reading from. The expected result
would be that any file operations on that handle will then fail. Your
thread which is blocked in a ReadFile call should then return.

Rich
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "jayderk" <[email protected]>
| Subject: Question for Chris Tacke regaring CEPorts class
| Date: Tue, 5 Aug 2003 15:01:46 -0500
| Lines: 21
| Organization: n/a
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
| Message-ID: <#[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 209.150.197.226
| Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP10.phx.gbl
| Xref: cpmsftngxa06.phx.gbl
microsoft.public.dotnet.framework.compactframework:30218
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| I was playing with the code a bit and was wondering if you had any
| suggestions on how to fix this problem I am having.
|
| first... I have the mainForm start a seperate thread that opens the comm
| port. It then goes in to a while loop (that calles CEAPI.ReadFile) until a
| condition is met.. it then exits the while loop closes the
| connection(CloseHandle) and the thread terminates.
|
| I seperated out the createFile and CloseHandle methods so I can leave the
| comm port open.
|
| I notice it sits at CEAPI.ReadFile for a long time..
| My question> is there a SAFE way to close the connection and kill the
thread
| while it is sitting at CEAPI.ReadFile? It says in Microsoft Core Reference
| the Abort is not supported in the CF.
|
| thanks in advance
| Jay
|
|
|
|
 
Back
Top