Bug in Win32file WaitCommEvent ???

Grant Edwards grante at visi.com
Fri Nov 22 10:41:06 EST 2002


In article <arl9cs$k6b$0 at 216.39.172.122>, Bengt Richter wrote:
> On Thu, 21 Nov 2002 23:44:54 GMT, Mark Hammond <mhammond at skippinet.com.au> wrote:
> 
>>Grant Edwards wrote:
>>
>>> I've verefied that the above is correct. I wrote a C program that verifies
>>> that the value pointed to by the pointer passed to WaitCommEvent() is
>>> written to later: after the event happens.  
>>
>>:(
>>
>>So what do we do?  We can't break backward compatibility.  I guess we 
>>may need a new function that manages a little 4-byte buffer for this value.
>>
> I don't have win32all, but don't you need to have the OVERLAPPED struct persist
> as well? Isn't the event slot there also used asynchronously?

Yes, the OVERLAPPED struct has to be persistent.  I've thought
about using that as storage for the comm event mask value, but
then we've got to add some sort of accessor function to
retreive it later.  The advantantage of using a 4-byte buffer
is that the semantics stay more similar to both the Win32
usage, and the way that data buffers work for overlapped
read/write operations:


   rc,mask = WaitCommEvent(handle,overlapped)
   rc = WaitForSingleObject(overlapped.hevent)
   whatHappened = int(mask)

-- 
Grant Edwards                   grante             Yow!  We just joined the
                                  at               civil hair patrol!
                               visi.com            



More information about the Python-list mailing list