简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM