[Bug 238650] pthread_getthreadid_np lacks libc stub

[email protected]
Newsgroups gmane.os.freebsd.devel.threading
Message-ID <[email protected]/bugzilla/>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238650

            Bug ID: 238650
           Summary: pthread_getthreadid_np lacks libc stub
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Keywords: needs-patch
          Severity: Affects Only Me
          Priority: ---
         Component: threads
          Assignee: [email protected]
          Reporter: [email protected]

A consumer may want to avoid -lpthread dependency if thread ID is not critical
e.g., only used for tracing/debugging.

Example:
https://github.com/freebsd/freebsd-ports/blob/d1e16f7b264b/multimedia/libva/files/patch-va_va__trace.c

Environment:
  $ cat a.c
  #include <stdio.h>
  #include <pthread_np.h>

  int main()
  {
          printf("%d\n", pthread_getthreadid_np());
          return 0;
  }

FreeBSD:

  $ cc a.c
  ld: error: undefined symbol: pthread_getthreadid_np
  >>> referenced by a.c
  >>>               /tmp/a-104ade.o:(main)
  cc: error: linker command failed with exit code 1 (use -v to see invocation)

  $ cc a.c -pthread
  $ ./a.out
  101610

DragonFly:

  $ cc a.c
  $ ./a.out
  0

  $ cc a.c -pthread
  $ ./a.out
  1

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-threads
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.