Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does IdHttpServer OnCommandGet event runs inside a thread?

Does the idHttpServer OnCommandGet run inside a thread? I guess Indy creates a thread and call this event inside it, but I am not really sure about it.

It Indy does that, is it ok to set a threadvar inside this event and read this var from the methods my OnCommandGet calls?

like image 369
Rafael Colucci Avatar asked Sep 01 '26 19:09

Rafael Colucci


1 Answers

Yes, it runs in a thread that Indy creates and manages. You can verify this by calling GetCurrentThreadID and comparing the result to the global MainThreadID variable.

Although you can use threadvars, consider just passing those values as simple parameters to the functions you call instead. Then you don't have all the downsides of global variables.

like image 182
Rob Kennedy Avatar answered Sep 04 '26 18:09

Rob Kennedy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!