tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pthread2lwp API



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On 22.04.2016 16:25, Taylor R Campbell wrote:
> Date: Fri, 22 Apr 2016 13:27:17 +0200 From: Kamil Rytarowski
> <n54%gmx.com@localhost>
> 
> In my current use-case is to access l_rtime_sec and l_rtime_usec
> from struct kinfo_lwp.
> 
> I don't see a way to do it cleanly, something different than
> reading opaque pthread_t pointer and accessing rawly pt_lid at some
> offset.
> 
> What is the motivation for trying to get at l_rtime_sec and 
> l_rtime_usec within your process?
> 

My motivation is to get time used by an arbitrary thread.

Lack of it makes NetBSD platform fatal (assert is triggered) after
recent changes to .NET, so for 7.0 I'm using _lwp_self() just to get
any result.

Alternatively adding support for pthread_getcpuclockid() + using
clock_gettime(3) would approximate the result (as it's done for Linux
and FreeBSD).

> In general the result can't be reliable -- the thread might exit
> as soon as you've gotten the lwpid.
> 

The same applies to the current interfaces, they are no different
here, except additional translation between pthread_t to lwpid_t. I
can live with this risk.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXGsihAAoJEEuzCOmwLnZsftcQAKEB2QFa3NE4iRSij9Xpl5d9
dXxLqin2nWFzH2u6VQ9kMBFWpmwFQ4AkNYqWmy6S2jExuNR1Z6B50UWf9/IFygqV
OsywOLuLQbA8P1ERkPkrfY1LQURuNYSsM5ST/RvP/X09CKJ01DGldWMkl4NfGizA
+ZgNVIu58XlOV4cwANh/kE4ytlCj0kX5TRQ6TGAicSOdkhUVG2WM3SBhoSZ7aYGn
OmWVi8LzDQNc0D6g2XgIoTtT9WqDSTR7KVM7MvvUdgINLneBiIuIJFup+iRrtBHH
2IJF4yKrJH5YYZWr7/AeHaZAbfD+0YuKV8WPPHg7IdezKAF7j5vqh7PbPeu+QQPS
8yAfjFg1qA/7TuPVLCW3JKyOkx2hzhzoY/xvjaGOMrI1pbBjFU5eAhKft2lWwwVX
uIzkqi25RSMCq6+xy5vGugB3Nj/5q24JbGlxDkrKkbw31pNo9ndUOOJ7t5+51yIm
+bOAzsPGs1b+TiqjjX3JPGbqKM4zDwBguqd1egR1kpHSywrdbB1gRbGD857UbBNi
dFIzAo6PQHt+dIRaAUog4Dpabxs4ZC4kCtXnnPEcCPanu89pNqTFDH9DsF6pRwIf
OR4n0Ey/5UPBgWDePzqyz5P2rFIOLs6BbCu2h6i5rBD86L06FwdcvocywSXFNnnQ
wnjt2yEA0md/5HmMcyiE
=ZoZ9
-----END PGP SIGNATURE-----


Home | Main Index | Thread Index | Old Index