"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Stefan Sperling <stsp@stsp.name>
Subject:
Re: [PATCH 2/2] tog: fix usage of deprecated pthread_yield
To:
Quentin Rameau <quinq@fifth.space>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 19 Sep 2021 14:51:51 +0200

Download raw body.

Thread
  • Quentin Rameau:

    [PATCH 2/2] tog: fix usage of deprecated pthread_yield

  • On Sun, Sep 19, 2021 at 01:51:20PM +0200, Quentin Rameau wrote:
    > The pthread_yield isn't portable, let's use the POSIX equivalent
    > instead.
    > ---
    >  tog/tog.c | 2 +-
    >  1 file changed, 1 insertion(+), 1 deletion(-)
    > 
    > diff --git a/tog/tog.c b/tog/tog.c
    > index 5af8f69f..791c2b51 100644
    > --- a/tog/tog.c
    > +++ b/tog/tog.c
    > @@ -848,7 +848,7 @@ view_input(struct tog_view **new, int *done, struct tog_view *view,
    >  		if (errcode)
    >  			return got_error_set_errno(errcode,
    >  			    "pthread_mutex_unlock");
    > -		pthread_yield();
    > +		sched_yield();
    >  		errcode = pthread_mutex_lock(&tog_mutex);
    >  		if (errcode)
    >  			return got_error_set_errno(errcode,
    > -- 
    > 2.33.0
    > 
    > 
    
    Don't we need to include <sched.h> in order to get sched_yield() declared?
    
    I've tried this change on OpenBSD and it seems to work.
    
    
    
  • Quentin Rameau:

    [PATCH 2/2] tog: fix usage of deprecated pthread_yield