Re: Thread blockiert Hauptprogramm



Heiko Nocon schrieb:

Und dann noch im speziellen: Könnte man den vorliegenden
Fall durch FILE_FLAG_OVERLAPPED lösen?

Nö, überhaupt nicht. Der zusätzliche Thread würde dann nur anstatt durch
den Aufruf von WaitCommEvent selber durch das nachfolgende Warten auf
das Event in der Overlapped-Struktur blockiert. Ansosnten ändert sich
nix.

Wie sich ja mittlerweile herausgestellt hat, stimmt das so nicht ganz:

Wenn CreateFile...
- ... _ohne_ FILE_FLAG_OVERLAPPED geöffnet wurde, blockieren während
des Wartens auf WaitCommEvent _alle_ anderen Aufrufe dieser Schnitt-
stelle (insbesondere auch SetCommMask und sogar CloseHandle, so daß
man das ganze zum Beenden nur "abwürgen" kann);
- ... _mit_ FILE_FLAG_OVERLAPPED geöffnet wurde, kann man während
WaitForSingleObject das Triggern des Events (auch) mit SetCommMask
auslösen, so daß man "geordnet" wieder aus dem Programm rauskommt.

Ist also doch ein ganz schöner Unterschied...

Gruß Matthias.
.



Relevant Pages

  • Re: Serial Communication Problem
    ... Always use timeouts for receive operation. ... Either SetCommMask or WaitCommEvent caused problems for me long time ago so I do not use them.(There is no need for them especially ... > CreateFile with overlap mode. ...
    (microsoft.public.windowsxp.embedded)
  • Re: settings for WaitCommEvent
    ... My code calls SetCommMask, then WaitCommEvent. ... while WaitCommEvent is waiting for data, and they are able to pull in data ... Chris Tacke, Embedded MVP ...
    (microsoft.public.pocketpc.developer)
  • settings for WaitCommEvent
    ... This is a 3 part question, all dealing with WaitCommEvent: ... My code calls SetCommMask, then WaitCommEvent. ... finished, do I need to re-call SetCommMask, or are the values still set? ... while WaitCommEvent is waiting for data, and they are able to pull in data ...
    (microsoft.public.pocketpc.developer)