I use HTTPSend to get / download info from the net (in a thread) and sometimes it gets stuck. That's why I need to kill it.If you are working with FpHTTPClient please read this thread: https://forum.lazarus.freepascal.org/index.php/topic,38472.0.html
OK, but what if the chunk is never sent / recieved?As @trev already mentioned you have to use FPHTTPClient.ConnectTimeout combined with TFPHTTPClient.Terminate. You have two cases:
is this luxury available in Synapse?I did take a quick look to THTTPSend(unit httpsend.pas). It has a KeepAliveTimout property, you can read more here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Keep-Alive
Even the memory is shared between threads. Pretty sure if the interrupt comes in the wrong moment (race condition), it can corrupt the entire memory for all threads in the process. Or leave a lock in place preventing other threads from doing any mem alloc.It is possible to do, if you lock the shared access by masking out signals. A signal arriving while masked out will be fired as soon as it is enabled again. So something like this would work perfectly fine:
So unless your thread is most basic, and has only a fixed amount of pre-alloc mem, when you kill the thread, you have a chance to corrupt the entire process.
If you must do the hard shutdown, consider running the task in a separate process instead. (and kill that process, if needed)