C++ Logo

std-proposals

Advanced search

Re: [std-proposals] ABI

From: zxuiji <gb2985_at_[hidden]>
Date: Wed, 10 Jul 2024 10:53:27 +0100
I say copy what the kernals do, move to an index based ABI. You create some
ioctl like function for every thing, including memory allocations. Then you
create yet another function like it for synchronised mode, something like
this:

int32_t stdiocall( int32_t index, int32_t call, va_list )
{
  int32_t res = -1;
   stdref *ref = getstdref( index );
   if (ref->semaphore == INVALID_SEMAPHORE )
        return (ref->creator != gettid) ? EPERM : stdrefcall( ref->ud,
call, va );
   if ( ref->wrlock == gettid() )
       return stdrefcall( ref->ud, call, va );
   if ( lock( ref->semaphore ) != 0 )
      return errno;
  res = -1;
   // Does the call modify ref->ud?
   if ( call & 0x1 )
     ref->wrlock = gettid();
   else
     ref->rdlock++;
   unlock( ref->sem );
   if ( call & 0x1 )
   {
      while ( ref->rdlock ) yield();
      res = stdrefcall( ref->ud, call, va );
      ref->wrlock = -1;
      return res;
   }
   while ( ref->wrlock ) yield();
   res = stdrefcall( ref->ud, call, va );
   if ( lock( ref->semaphore ) != 0 )
      return errno;
   ref->rdlock--;
   unlock( ref->semaphore );
   return res;
}

With this setup not only do you provide a consistent ABI to interact with
internal objects with but you also take care of thready safety in the
process. Can just have an optional stdrdlock/stdwrlock/stdunlock set of
functions for when multiple calls need to be made in a loop

On Wed, 10 Jul 2024 at 09:21, Hans via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 08/07/2024 17:46, Jonathan Wakely wrote:
> > "There is great reticence to add new standard library classes"
> >
> > Is there? I'm not sure I want to live in a world where we add a lot
> > /more/ classes to the standard, if what we have now is the result of
> > great reticence!
>
> It is my understanding that proposals have been rejected on the basis of
> ABI stability. If that impression is wrong, please let me know and I'll
> remove that sentence.
>
> > The comparison with previous proposals would benefit from references to
> > those proposals.
>
> I'm not sure if there were ever any papers, or if they were just ideas
> floated in the community.
>
> Apart from this, what's your feeling on the idea in general?
>
>
> Hans Guijt
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2024-07-10 09:46:26