Skip to content
This repository was archived by the owner on Jun 30, 2025. It is now read-only.
This repository was archived by the owner on Jun 30, 2025. It is now read-only.

Thread ID on macOS #182

@jgehring

Description

@jgehring

I'm using glog on macOS and noticed that gettid(2) is used to obtain a "thread ID". However, on macOS this function is quite different from Linux and the output is not very useful for logging as it represents the uid and gid of a thread (see the explanation at http://elliotth.blogspot.co.uk/2012/04/gettid-on-mac-os.html, for example). As a result, multiple runs of the same program will usually end up with the same "thread ID" which makes analyzing logs quite painful. The linked blog post also mentions that it's possible to use pthread_threadid_np(3) starting from 10.5. Did you ever consider using this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions