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?
597 Views Asked by rossmcm At
1
There are 1 best solutions below
Related Questions in MULTITHREADING
- new thread blocks main thread
- WPF MessageBox Cancel checkbox check
- How to avoid concurrent access to a resource?
- run oncomplete event in async
- Threading Segfault when reading members
- Function timeouts in C and thread
- How are multiple requests to Task.Run handled from a resource management standpoint?
- Acumatica perfomance with threads
- Wait and Notify in Java threads for a given interval
- Different behavior of async with Visual Studio 2013(Windows8.1) and GCC 4.9(Ubuntu14.10)
- How to return blocking queue to the right object?
- background thread using Task.Run
- deletion and cleanup of worker thread in Qt crashes
- Pipeline-like operation using TChan
- implementing in app purchase on android
Related Questions in DELPHI
- How to not load all database records in my TListbox in Firemonkey Delphi XE8
- How to catch WM_DEVICECHANGE in a control other than TForm?
- show information with Rolling / moving messages delphi xe7
- What is the different between "Console target" and "GUI target" in DCC32 option?
- How to add new online ressources to RAD Studio help system
- C# and Delphi code have different behaviour when importing unmanaged dll
- Loop through records on a cxgrid and update a field/column
- Delphi 7 - Save to a Specific .INI Files Name
- TImagelist for large images
- how to modify a function so it returns an array of strings
- Checking for internet connection in runtime
- How can I make the main form align correctly after my control height is autosized and then I maximize the form?
- fetch data from web service to dataset in Delphi
- Load candlestick data from file
- Infinite loop in parsing a string using pointer math
Related Questions in THREAD-SAFETY
- Wait and Notify in Java threads for a given interval
- Calculating average and percentiles from a histogram map?
- whether the Android FragmentTransaction.replace() is thread safety?
- Is a SecurityContext shared between requests when using Spring Security?
- Singleton class and thread safety
- Why is the standard C# event invocation pattern thread-safe without a memory barrier or cache invalidation? What about similar code?
- Wordpress - require wp-db
- Problems with big C# list, list is inaccessible
- Using Task.Factory.StartNew() Then Return Value
- Python thread locks vs forced timer delays
- Report generation in server
- Synchronize multiple reads and writes in a list of thread safe objects
- Best way to handle ERESTARTSYS in kthread?
- Does FileShare.None make threads wait until the filestream is closed?
- Is it necessary to end a ThreadPool on Application.Exit()?
Related Questions in TERMINATE
- Windows Phone asynchronous call terminates
- C# Process Termination notifications
- Why is a destructor not called when I click the close button on the console?
- Which event is called when iOS app is swiped from app switcher?
- The most reliable way to terminate a family of processes
- Kill Specified Task instead of Process in C#
- Terminating while loops at anypoint within the loop by user input, using python
- Close Image with subprocess
- Old iOS application crashes after launch screen
- Python MQTT Connect only for a limited time
- C program is interrupted during the execution of “system” function
- how to terminate qthread in python
- How do I exit my program without using return and System.exit()?
- TSR in assembly save in memory
- Rserve server: how to terminate a blocking instance (eval taking forever)?
Related Questions in DELPHI-2006
- delphi 2006 indy https post time out
- Delphi .PAS code reverts to the previous code after compile/build
- What is the simplest way to add an AlphaBlendValue property to Delphi's TImage
- Why doesn't this D2006 code to fade a PNG Image work?
- How might I find out the source of long delays on resizing the main form?
- How to avoid getting an error 10053 (WSAECONNABORTED) if a HttpGet operation in Android is lasting too long?
- how set color of otherslice
- Delphi - Application independent of Regional Settings
- Local string array initialization
- Why TForm's _release does not call destructor?
- MIDIYOKE in Delphi 2006
- Porting a Delphi 2006 app to XE
- Migrating from Delphi 2006 to Delphi XE2
- Inheriting a method from the ancestor's ancestor
- What's a simple way of programmatically simulating user input?
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)
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?
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.