Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread TServerRequestQueue.GetNewRequest
Wed, Jun 29 2016 11:38 AMPermanent Link

Matthew Jones

Could you clarify the lifetime and ownership of
TServerRequestQueue.GetNewRequest returns please? If I call it, who
owns the allocated request? When does it get freed? Is that something
that happens automatically after the callback, or some other time?

--

Matthew Jones
Wed, Jun 29 2016 12:25 PMPermanent Link

Raul

Team Elevate Team Elevate

On 6/29/2016 11:38 AM, Matthew Jones wrote:
> Could you clarify the lifetime and ownership of
> TServerRequestQueue.GetNewRequest returns please? If I call it, who
> owns the allocated request? When does it get freed? Is that something
> that happens automatically after the callback, or some other time?
>

We have the framework source and my interpretation after looking at it
is as follows:

- the main benefit of using GetNewRequest (over just doing
TServerRequest.Create in your code) is that TServerRequestQueue
maintains a pool of requests and can return one of those

- at that point you own it

- however if you add the request back to the TServerRequestQueue  then
it will own it for you (and once complete or cancelled will add it to
the available request queue again)

Raul
Wed, Jun 29 2016 12:44 PMPermanent Link

Matthew Jones

Raul wrote:

> We have the framework source and my interpretation after looking at
> it is as follows:
>
> - the main benefit of using GetNewRequest (over just doing
> TServerRequest.Create in your code) is that TServerRequestQueue
> maintains a pool of requests and can return one of those
>
> - at that point you own it
>
> - however if you add the request back to the TServerRequestQueue
> then it will own it for you (and once complete or cancelled will add
> it to the available request queue again)

Okay, that's handy to know. Would be good to have that documented in
the help so one can know to "not care" too much.

--

Matthew Jones
Image