tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Introduce curlwp_bind and curlwp_unbind for psref(9)



On Mon, Jun 13, 2016 at 11:21 PM, Taylor R Campbell
<campbell+netbsd-tech-kern%mumble.net@localhost> wrote:
>    Date: Mon, 13 Jun 2016 14:00:16 +0200
>    From: Joerg Sonnenberger <joerg%bec.de@localhost>
>
>    On Mon, Jun 13, 2016 at 07:36:31PM +0900, Ryota Ozaki wrote:
>    > Currently we do it by open-coding in each place,
>    > but we should provide some API to simplify codes.
>    > riastradh@ suggested curlwp_bind and curlwp_unbind
>    > some time ago (*1) and this patch (*2) just follows
>    > the idea.
>
>    The primary question for me is whether nesting should be allowed or not.
>    That would mean a reference count behind the flag.
>
> This `reference count' gets stored on the stack.  The caller does:
>
>         int bound = curlwp_bind();
>
>         ... psref_wotsit ...
>
>         curlwp_unbind(bound);
>
> If it was already bound, bound = 1 and curlwp_unbind does nothing; if
> it was not already bound, bound = 0 and curlwp_unbind unbinds it.
>
> Perhaps the name should be `curlwp_bound_restore' or something else to
> emphasize this, but I haven't come up with one that I like better on
> aesthetic grounds.

- curlwp_bind and curlwp_unbind
- curlwp_bound_set and curlwp_bound_restore
- curlwp_bound and curlwp_boundx

Any other ideas? :)

  ozaki-r


Home | Main Index | Thread Index | Old Index