Skip to content

Fix portability issue with pthreads#15968

Merged
laanwj merged 1 commit intobitcoin:masterfrom
grim-trigger:master
May 16, 2019
Merged

Fix portability issue with pthreads#15968
laanwj merged 1 commit intobitcoin:masterfrom
grim-trigger:master

Conversation

@grim-trigger
Copy link
Contributor

This change resolves the following issue:
#15951

Only tested on OpenBSD 6.5/amd64

This change resolves the following issue:
bitcoin#15951

Only tested on OpenBSD 6.5/amd64
@fanquake
Copy link
Member

fanquake commented May 7, 2019

tACK 1b05dff. Tested on OpenBSD6.4 (vagrant).

Pre patch:

  CXX      util/libbitcoin_util_a-rbf.o
  CXX      util/libbitcoin_util_a-threadnames.o
util/threadnames.cpp:26:5: error: use of undeclared identifier 'pthread_set_name_np'
    pthread_set_name_np(pthread_self(), name);
    ^
1 error generated.
gmake[2]: *** [Makefile:8666: util/libbitcoin_util_a-threadnames.o] Error 1
gmake[2]: *** Waiting for unfinished jobs....

with this PR make check builds and all tests pass.

@laanwj
Copy link
Member

laanwj commented May 8, 2019

utACK 1b05dff
(I think it'd be slightly better, at least more general, to detect the need for these includes in the configure script, but this is fine to work around the immediate issue)

@DrahtBot
Copy link
Contributor

DrahtBot commented May 8, 2019

Gitian builds for commit 3632143 (master):

Gitian builds for commit 1da169961518949bed9f1811e3d1345dedd4061a (master and this pull):

@grim-trigger
Copy link
Contributor Author

@laanwj

(I think it'd be slightly better, at least more general, to detect the need for these includes in the configure script, but this is fine to work around the immediate issue)

I agree that the most general way is best. I just followed the existing convention from https://github.com/bitcoin/bitcoin/blob/master/src/util/system.cpp :

#if (defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__))
#include <pthread.h>
#include <pthread_np.h>
#endif

Is there anything else I need to do?

@laanwj
Copy link
Member

laanwj commented May 16, 2019

No, it's ok, going to merge this, sorry for the delay.

@laanwj laanwj merged commit 1b05dff into bitcoin:master May 16, 2019
laanwj added a commit that referenced this pull request May 16, 2019
1b05dff Fix portability issue with pthreads (grim-trigger)

Pull request description:

  This change resolves the following issue:
  #15951

  Only tested on OpenBSD 6.5/amd64

ACKs for commit 1b05df:
  fanquake:
    tACK 1b05dff. Tested on OpenBSD6.4 (`vagrant`).
  laanwj:
    utACK 1b05dff

Tree-SHA512: af48581af32820d5adc9ae5abb44f8f1b592c323f86fe2484108b81629389f6ef347598f9a087aa6476ac553e59828cd7927bb4ab11dc70e7c9a944a92fc54ae
sidhujag pushed a commit to syscoin/syscoin that referenced this pull request May 18, 2019
1b05dff Fix portability issue with pthreads (grim-trigger)

Pull request description:

  This change resolves the following issue:
  bitcoin#15951

  Only tested on OpenBSD 6.5/amd64

ACKs for commit 1b05df:
  fanquake:
    tACK 1b05dff. Tested on OpenBSD6.4 (`vagrant`).
  laanwj:
    utACK 1b05dff

Tree-SHA512: af48581af32820d5adc9ae5abb44f8f1b592c323f86fe2484108b81629389f6ef347598f9a087aa6476ac553e59828cd7927bb4ab11dc70e7c9a944a92fc54ae
deadalnix pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Mar 24, 2020
Summary:
Fixes the build on some *BSD.

Backport of core [[bitcoin/bitcoin#15968 | PR15968]].

Depends on D5540 (and D5542 for the test plan).

Test Plan:
  ninja check
Build on FreeBSD 12.0.

Reviewers: #bitcoin_abc, jasonbcox

Reviewed By: #bitcoin_abc, jasonbcox

Differential Revision: https://reviews.bitcoinabc.org/D5541
ftrader added a commit to bitcoin-cash-node/bitcoin-cash-node that referenced this pull request Dec 1, 2020
Thread names in logs and deadlock debug tools

See merge request bitcoin-cash-node/bitcoin-cash-node!834

This is a backport of [PR15849](bitcoin/bitcoin#15849) (Thread names in logs and deadlock debug tools).

See original PR for benchmarks.

Also includes some smaller follow-up PR's:
* [PR15968](bitcoin/bitcoin#15968) - Fix portability issue with pthreads
* [PR16984](bitcoin/bitcoin#16984) - util: Make thread names shorter
* [PR17038](bitcoin/bitcoin#17038) - Don't rename main thread at process level

## Test plan

New tests: `ninja check`

Run with `-logthreadnames`, observe lines are prefixed with thread

```
2020-10-28T11:39:16Z [init] init message: Done loading
2020-10-28T11:39:16Z [opencon] opencon thread start
2020-10-28T11:39:16Z [dnsseed] 0 addresses found from DNS seeds
2020-10-28T11:39:16Z [msghand] msghand thread start
2020-10-28T11:39:16Z [dnsseed] dnsseed thread exit
```

Compile with lockorder debugging enabled: `cmake -GNinja -DCMAKE_BUILD_TYPE=Debug ..`
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Aug 11, 2021
1b05dff Fix portability issue with pthreads (grim-trigger)

Pull request description:

  This change resolves the following issue:
  bitcoin#15951

  Only tested on OpenBSD 6.5/amd64

ACKs for commit 1b05df:
  fanquake:
    tACK 1b05dff. Tested on OpenBSD6.4 (`vagrant`).
  laanwj:
    utACK 1b05dff

Tree-SHA512: af48581af32820d5adc9ae5abb44f8f1b592c323f86fe2484108b81629389f6ef347598f9a087aa6476ac553e59828cd7927bb4ab11dc70e7c9a944a92fc54ae
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants