On Wed, Jul 24, 2024, 7:06 PM Rob Landers <rob@bottled.codes> 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" 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.

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

Reply via email to