I have a thread that sometimes freezes (I suspect) due to a DLL call that never returns. In the general case, where you have calls to blocking routines like Indy, is there a way of recovering from this in such a way that the thread OnTerminate handler fires? Will this happen if I call TerminateThread?
Delphi 2006 - What's the best way to gracefully kill a thread and still have the OnTerminate handler fire?
598 views Asked by rossmcm At
1
There are 1 answers
Related Questions in MULTITHREADING
- How can I outsource worker processes within a for loop?
- OpenMP & oneTbb difference
- Receiving Notifications for Individual Task Completion OmniThreadLibrary Parallel.ForEach
- C++ error: no matching member function for call to 'enqueue' futures.emplace_back(TP.enqueue(sum_plus_one, x, &M));
- How can I create a thread in Haskell that will restart if it gets killed due to any reason?
- Qt: running callback in the main thread from the worker thread
- Using `static` on a AVX2 counter function increases performance ~10x in MT environment without any change in Compiler optimizations
- Heap sort with multithreading
- windows multithreading CreateMutex
- The problem of "fine-grained locks and two-phase locking algorithm"
- OpenMP multi-threading not working if OpenMPI set to use one or two MPI processor
- WPF Windows Initializing is locking the separated thread in .Net 8
- TCP Client Losing Connection When Writing Data
- vc++ thread constructor throwing compiler error c2672
- ASP.NET Core 6 Web API : best way to pause before resending email
Related Questions in DELPHI
- How can I read the header of request to webserver
- Receiving Notifications for Individual Task Completion OmniThreadLibrary Parallel.ForEach
- Delphi - How to get result of function from QuickReport without viewing a report?
- Out of memory while adding documents to a Firebird BLOB field with Delphi
- How to MakeScreenshot fullpage on Delphi
- How to program a COM object with an IEnumerator, IEnumerable interface inside
- How to Dynamically Add Controls to Delphi Form
- How to write a string in Stringrid with DelimitedText in FMX Delphi 11
- TGrid/TStringGrid multi cell selection / multi editing in delphi firemonkey (12)
- How to localize "Today" in the Delphi TMonthCalendar?
- How can I call a SOAP webserver method in Vue.js?
- Efficiently Handling Large Number of API Calls with Delphi 10.4 and OmniThreadLibrary
- Delphi can not compile the unit create by its "XML Data Binding Wizard"
- Save Form Properties in File and then restore those Properties after reopening
- Is it possible to open a blob without saving it to file
Related Questions in THREAD-SAFETY
- Multiple Processes, Multiple Processors, Single Priority Queue - Java Thread-Safe and Concurrency -
- Thread-safe lock-free min where both operands can change c++
- Atomic increment operation in C++?
- In Java, a currying function is thread-safe or not
- How can I make my flask + sqlite3 application threadsafe
- Thread task not exiting when atomic value changed
- Issues with Concurrent Execution and Synchronization in a Custom Java Caching Mechanism
- Why is SpringApplicationBuilder.run made as thread-safe?
- lua_continuation, lua_thread functions
- Virtual threads in Java with backwards compatibility
- AWS Go SDK V2: assuming different roles concurrently
- Why does my PyQt5 and Vispy application only update the GUI when adding sleep in QThread's loop?
- Different threads updating different attribute of the same object, will it work?
- How to avoid Duplicate Document Numbers for Invoice created through netsuite RESTAPI
- In Rust, how to create a globally shared singleton with `OnceLock`?
Related Questions in TERMINATE
- Codespace terminates my code within seconds?
- Understand what really happens when calling a throwing function in a noexcept function
- Does this criteria prove that Y calls X in infinite recursion?
- How can I determine whether a user is watching YouTube Shorts or using the regular YouTube app within my Flutter application?
- Powerbuilder Response window hangs then App closes - Any ideas?
- How to make sure the process signalled to terminate using TerminateProcess WinAPI is actually terminated?
- Elegant loop exit using input() with multithreading
- Running a custom termination of a process in python multiprocessing
- How to terminate processes in a specific order?
- How to properly terminate a process that is running in the background via subprocess?
- Cannot terminate or kill subprocess after building .exe with pyinstaller
- Is there any keyword that will terminate or stop the simulation when the output reaches a specific value in open modelica?
- Which function is invoked on click of notification while flutter android app is in terminated state, background notification click FCM
- What should i write inside JOptionPane.YES_NO_OPTION
- IPOPT Options Not Settable in Visual Studio 2022 Release Configuration
Related Questions in DELPHI-2006
- Windows slowing down with mouse pointer on destop
- Delphi (2006): how to Split by new line and break at the same time
- Why loop While with for inside doen't work?
- Is it possible to typecast a callback function in Delphi?
- Use TQuery.Locate() function to find other then first matching
- Removing part of condition in some cases
- Delphi 2006 proper use of END
- Local form in delphi 2006
- TPageControl component in Delphi 2006
- Pass WideString to raise an exception
- Working with mili second DateTime with culture specific format in Delphi
- class operator with result of Extended type does not work in BDS2006?
- _Document.SaveAs prompts unexpected
- Where is the sizing data of TOpenDialog stored and how can this be reset?
- Conditionally change application icon with Delphi 2006
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
TerminateThread()is an immediate brute-force termination. It will NOT let theOnTerminaateevent fire. The only wayOnTerminatecan fire is if the thread'sExecute()method exits through normal means, whether that be gracefully or by raising an uncaught exception (which will set the thread'sFatalExpectionproperty).In the case of Indy specifically, a blocking socket operation can be aborted by disconnecting the socket from the context of another thread. That is not usually possible with blocking DLL functions, unless they expose that kind of functionality in their API.