![]() |
AW: TThread mit Queue und Events
Zitat:
Deshalb könnte es mit Events insgesamt reaktiver werden und auch sicherer gegen Deadlocks, weil Events sich von aussen killen lassen. Die Timer-Präzision sollte nicht den Unterschied machen, das ist meiner Meinung nach gleich. Nur bei Cross-Plattform gibt es da generell Vorteile, aber dann auch bei Sleep und WaitFor gleichermaßen. |
AW: TThread mit Queue und Events
Zitat:
Daher macht für mich ein Sleep in einem Thread nie einen Sinn. Zitat:
Zitat:
Mavarik :coder: |
AW: TThread mit Queue und Events
Zitat:
Aber wer soll das Event auslösen, wenn ich z.B. einen Server pollen möchte, ob er neue Daten hat? Aber eben mit etwas Wartezeit dazwischen. Es gibt auch andere Konstellationen als dass ein Thread zur Beschleunigung durch Parallelisierung dienen soll oder auf konkret abfragbare Events wartet. |
AW: TThread mit Queue und Events
Zitat:
1) block on "recv" and skip the event altogether or 2) block on "select" to get the state of the socket and have the exact moment of/for receiving data, or 3) use WSAEventSelect and WSAAsyncSelect , these are powerful to combine with other complex or non-complex operation, events here become central notification for one or more threads. 4) IOCP and don't even wait manually, get the operation and process the data in place within the thread knowing there is other threads allowed to process other client... 5) .. 6) .. there is many approaches and that only for handling sockets on server or client side, same goes for files ReadFile and ReadFileEx, they have differences and can combined in many different ways, if you prefer events then overlapped with supplied event is the way to go, work like charm with com and legacy communication ports, allowing you to utilize the maximum throughput being writing files to disk or sending data to hardware wire or a driver ... The overlapped design and operation are powerful and efficient, the core of overlapped mechanism is low level kernel triggered events. Zitat:
other than that i see polling as waste of time and CPU cycle as as Mavarik, for fast and lazy or limited usage then yes, poll then execute then sleep for short time, but with servers with many clients and many threads, this is a waste. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 06:54 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz