public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] Use of -pthread
Date: Thu, 11 May 2017 10:10:06 +0200	[thread overview]
Message-ID: <20170511081006.GA306@rei.lan> (raw)
In-Reply-To: <BN6PR11MB205152E1D9CD5D131EA5A752CDEC0@BN6PR11MB2051.namprd11.prod.outlook.com>

Hi!
> sge@oststbldvm09 ltp $ find . -name Makefile|xargs grep -- -pthread
> ./lib/newlib_tests/Makefile:test08: CFLAGS+=-pthread
> ./lib/newlib_tests/Makefile:test09: CFLAGS+=-pthread
> ./lib/tests/Makefile:tst_cleanup_once: CFLAGS += -pthread
> ./testcases/kernel/mem/hugetlb/hugemmap/Makefile:hugemmap06: CFLAGS+=-pthread
> ./testcases/kernel/security/dirtyc0w/Makefile:dirtyc0w_child: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wait03: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wake02: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/futex/Makefile:futex_wake04: CFLAGS+=-pthread
> ./testcases/kernel/syscalls/sched_getattr/Makefile:CFLAGS                       += -pthread
> ./testcases/kernel/syscalls/sched_setattr/Makefile:CFLAGS                       += -pthread
> ./testcases/kernel/syscalls/signal/Makefile:signal06: CFLAGS+=-pthread
> 
> 
> Other tests (50+) use:
> 
> LDLIBS += -lpthread
> 
> Instead. 
> 
> Any reason for the difference?

Likely only historical. The only correct way how to link against
libpthread is -pthread in CFLAGS (as it's written in any pthread_*
manual page). Adding -lpthread into LDLIBS may work most of the time but
will fail rarely.

The uses of -lpthread should be replaced with -pthread.

-- 
Cyril Hrubis
chrubis@suse.cz

      reply	other threads:[~2017-05-11  8:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 18:51 [LTP] Use of -pthread Steve East
2017-05-11  8:10 ` Cyril Hrubis [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170511081006.GA306@rei.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox