C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Interceptor Function (preserve stack and all registers)

From: Thiago Macieira <thiago_at_[hidden]>
Date: Mon, 29 Jul 2024 13:49:25 -0700
On Monday 29 July 2024 09:18:44 GMT-7 Frederick Virchanza Gotham via Std-
Proposals wrote:
> I don't know where you're going with your linked list. If you look at the
> GodBolt I gave you, you'll see I have it working on x86_32 with one simple
> thread-local variable.
>
> Ain't no linked lists round these parts.

You missed my point of reentrancy: what happens if this function is reentered
on the same thread while it's already running?

Why would it do that? Well, why wouldn't it do that? You want to contemplate
this as a Standard feature, so it needs to contemplate the use-case when the
function is recursive.

int OpenSocket(int af, std::string_view address)
{
    if (af == AF_INET)
        return OpenSocket(AF_INET6, std::string("::ffff:") + address);
    return OpenSocket_inner(address);
}

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2024-07-29 20:49:28