Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:124570 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id E69951A00B7 for ; Wed, 24 Jul 2024 12:11:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1721823182; bh=8MYJYiStrb6LN1cMW7sbhPfsFRvDEF+uPDPVBD/Ju40=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=GL8qvwo6GkPn+MGuHi/4orkncBnZRXpK3cNyKR9n4LvXKzTzhengA6pw86DMvGhBQ A7MA7vOgEODYMlDRfPNhwfOgAAqnnCaheQADkwmj+cCVz8oClx/JYKd9VveW9qHfXc 2kRZhThkeqeLQ+SR49zdJLx6gh1w5x5JNKNavpeGOqxnXW6z3yX9VrUux5TWJLmqtW YdX9Bfc1M86GmYZV0VNrRhQJaOHTmxGhd6XW2wO8UVUs/Kl/WtVa0OVGmBu+rI+yxf Yazzdkth8+AtOhVdA90QRO6HR/hyXHHnFZV8hShBl5+3WnYGMLFa3o8ekzzPpE7hXp 8WjDOOdrG0iOg== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 067261801EF for ; Wed, 24 Jul 2024 12:13:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_50,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,DMARC_PASS,FREEMAIL_FROM, HTML_MESSAGE,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Wed, 24 Jul 2024 12:12:57 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id 41be03b00d2f7-7a1843b4cdbso1308714a12.2 for ; Wed, 24 Jul 2024 05:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721823082; x=1722427882; darn=lists.php.net; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=8MYJYiStrb6LN1cMW7sbhPfsFRvDEF+uPDPVBD/Ju40=; b=KAtnZoOlyz16AfRwUPrRWqxC767zJD+aRXu9Dl4C8loJfVK97chYMfuZZYha01UjG1 CzpiAQ7Jq1AWixGX7vDOS1Vxm9KuOO8mvTIURqC4JjwywtrO+XQDs4T9PrnwE3SZTZt8 YbGcwS5m10gQArhareq/zGah8JCuvXlIZj4jbwYcRFwF745elkNELJX8opxYc9pdozW9 QM+NRlkUOgmOfDjc04tU3Xg44rB1z0AtGobAN+5jnIGuBtcQtAuUc4wxga4L+2WzTL+3 2yuz7FPB7jDX+PHOpIvi4xl+Jy4u85upqIUIXTpPkDXA6dom2VurtPeadBe5Z1kzpq+b kDRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721823082; x=1722427882; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8MYJYiStrb6LN1cMW7sbhPfsFRvDEF+uPDPVBD/Ju40=; b=TQPxNIwLtwTbouRjsrifkLMmIYt/E++YbvymCWPUfOC1aUscEwLKfs++X3Wz6fyY+K Ltp84kjDcH7i7XiV969avDm5FTW6jA8eLsv8EGQVIegFiShmKlN4cHsl3via0PTNL/+W Sp+5h8Yen72hMGKEyUOKuK3YyiZEeaHdRQZeRnk/GGPtZUkFtOA3uZwAL3Ut4FZXIv6c d3OaeFgNdvyPnXYaaYDacRUznF7m9N6ChBdsU+uvaFnsLLgUArGxaF4fVpmMwSfZrfA3 g5uojpcCeew8tE/jS6AIiGIYFtTZUOHIbJZdjdaMZkKm5rjKmxr5u6IgvHOlTkWtlB04 NpDQ== X-Gm-Message-State: AOJu0Yze/lbPto/Uska/ytZDOx/pdk8bYF27+pIEBMK9zPcxyguNaJLM aXIN9tmL8D2v4i8ghjnmBLFoW5eUOqTu6eXgmqveebWyFpc45h0BdjEPE+H6IvDiCPrp8zLvfen 0dG5XwrVRWywG17LMWdhNhBPsPSA= X-Google-Smtp-Source: AGHT+IHqKbFXGjMbXriWZ4vXUPVqy8ZfkSmKFWQoS+fcOIeEKZZI7Q0nvcmG+Diea0kMPQC/cEQYd86yXVOBXnHKegA= X-Received: by 2002:a17:90a:4e08:b0:2c8:7330:68b3 with SMTP id 98e67ed59e1d1-2cdb51f104dmr2130649a91.39.1721823081591; Wed, 24 Jul 2024 05:11:21 -0700 (PDT) Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 References: <9828b776-660f-44ad-91df-11bea14230a4@app.fastmail.com> <889a6014-299b-4be5-956e-ae5134bb6dfb@app.fastmail.com> In-Reply-To: <889a6014-299b-4be5-956e-ae5134bb6dfb@app.fastmail.com> Date: Wed, 24 Jul 2024 19:11:10 +0700 Message-ID: Subject: Re: [PHP-DEV] tsrm question To: Rob Landers Cc: PHP internals Content-Type: multipart/alternative; boundary="00000000000024fde1061dfd2d12" From: pierre.php@gmail.com (Pierre Joye) --00000000000024fde1061dfd2d12 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Jul 24, 2024, 7:06=E2=80=AFPM Rob Landers wrote= : > > The number of threads are static (at least for now), so we should def do > this. > > Long story short, the TSRM API is very flexible, how and when you > alloc/free rsrc is basically up to you. It is possible to keep some > around in the root thread (and be used in other threads, given the > root thread id is known (can be 0 or else depending how franken > managed them. > > > Ah, so this is where I was getting confused. It's unclear what the "id" i= s > and what it is used for. For example, I see the engine has a couple of id= s > (compiler/execution) but I'm unclear what the sapi should be doing with > them. Should these "ids" be different per thread, or is it just an > arbitrary key? > there are two ids you can pass. The rsc ID and the thread ID. By default the thread ID will be the current thread. the rsrc is the one you get when creating a new rsc (fetching a non existent one will create it btw). I would suggest to read the comments in the implement of ts_resource, lot of useful information are explained there :) best, Pierre --00000000000024fde1061dfd2d12 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


On Wed, Jul 24, 2024, 7:06=E2=80=AFPM Rob Lan= ders <rob@bottled.codes> wrote:
<= div>

The number of threads are static (at least for now)= , so we should def do this.

Long story short, the TSRM API is v= ery flexible, how and when you
alloc/free rsrc is basically u= p to you. It is possible to keep some
around in the root thre= ad (and be used in other threads, given the
root thread id is= known (can be 0 or else depending how franken
managed them.<= br>

Ah, so this is where I was gettin= g confused. It's unclear what the "id" is and what it is used= for. For example, I see the engine has a couple of ids (compiler/execution= ) but I'm unclear what the sapi should be doing with them. Should these= "ids" be different per thread, or is it just an arbitrary key?

= there are two ids you can pass. The rsc ID and the thread ID.=C2=A0

By default the thread ID will b= e the current thread.

th= e rsrc is the one you get when creating a new rsc (fetching a non existent = one will create it btw).

I would suggest to read the comments in the implement of ts_resource, lot = of useful information are explained there :)

best,
Pierre
--00000000000024fde1061dfd2d12--