Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Sep 1997 16:59:26 -0700 (PDT)
From:      cmf@netins.net
To:        freebsd-gnats-submit@FreeBSD.ORG
Subject:   misc/4470: libc_r deviates from the pthread standard
Message-ID:  <199709042359.QAA02296@hub.freebsd.org>
Resent-Message-ID: <199709050000.RAA02355@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         4470
>Category:       misc
>Synopsis:       libc_r deviates from the pthread standard
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Sep  4 17:00:00 PDT 1997
>Last-Modified:
>Originator:     Carl Fongheiser
>Organization:
>Release:        3.0-CURRENT
>Environment:
FreeBSD kf0yn.ampr.org 3.0-CURRENT FreeBSD 3.0-CURRENT #1: Thu Jul  3 23:12:41 C
DT 1997     cmf@kf0yn.ampr.org:/usr/src/sys/compile/OSITOS  i386

>Description:
The function called pthread_yield() is actually called sched_yield()
in the standard.  This is pointed out in the errata to "Programming
with Threads", found at http://sunsite.queensu.ca/sunmicro/sunpress/threads/errata.html

Also, the PTHREAD_*_INITIALIZER definitions are
part of the public interface, and thus should not be
squirreled away in pthread_private.h in the library
sources.
>How-To-Repeat:
Compile the following program.  Compare to a
compliant system.

#include <pthread.h>

pthread_mutex_t dummy_mutex = PTHREAD_MUTEX_INTIALIZER;

void *thread_func(void *);

main()
{
    pthread_thread_t my_thread;

    pthread_create(&my_thread, NULL, thread_func, NULL);
    pthread_join(my_thread);
}

void *thread_func(void *thread_param)
{
    for (;;)
	sched_yield();
}
>Fix:
Rename pthread_yield(), and move structure and
initializer definitions out of pthread_private.h, 
and into pthread.h.
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709042359.QAA02296>