#1 2025-06-16 05:03:06

testgary
Member
Registered: 2025-02-06
Posts: 27

TJsonClient + TSynThreadPool

I need to execute the TJsonClient.Request method inside a thread pool task, but I have a problem: how can I pass an array of const parameter?

In such a situation, how would you operate?

I looked at the official code and found that it directly used the addresses of records and classes.However, both records and classes cannot pass an array of const.

procedure TCustomThreadPool.Task(aCaller: TSynThreadPoolWorkThread; aContext: pointer);
begin
  TJsonClient.Request(const Method, ActionFmt: RawUtf8;
      const ActionArgs, QueryNameValueParams, HeaderNameValueParams: array of const;
      var Res; ResInfo: PRttiInfo;
      const CustomError: TOnJsonClientError = nil);
end; 

Last edited by testgary (2025-06-16 06:21:32)

Offline

#2 2025-06-16 07:59:34

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 15,069
Website

Re: TJsonClient + TSynThreadPool

You can use JsonEncode() and the JSON direct methods.

Offline

Board footer

Powered by FluxBB