Skip to content

Conversation

hutch
Copy link
Contributor

@hutch hutch commented Jan 10, 2017

On macOS 10.12 (Sierra) syscall(2) has been deprecated. The result is that using plog as-is produces a deprecation warning for every source file including plog.

This pull request deals with that.

@SergiusTheBest
Copy link
Owner

Hi Bob,

Thanks for contributing! I'm wondering whether we can completely remove syscall and use pthread_threadid_np for all macOS versions?

Copy link
Owner

@SergiusTheBest SergiusTheBest left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually this changeset has no sense (Restrict the scope of tid64. 2c03086)

@hutch
Copy link
Contributor Author

hutch commented Jan 10, 2017

Hi,

Thanks for plog!

I don't know. I have access to a mac still running 10.11, but not until tomorrow at the earliest. I can check then.

It looks as though it's been around since at least 2013 based on one thread I found. Another thread says it was introduced with OSX 10.6 -- actually several. If this is true, then you're probably right.

@hutch
Copy link
Contributor Author

hutch commented Jan 10, 2017

Why does it have no sense? You mean the curly braces? Possibly not, but it does localise the variable.

@SergiusTheBest
Copy link
Owner

Yes, curly braces. Removing all macro stuff will produce the following:

        inline unsigned int gettid()
        {
            {
              uint64_t tid64;
              pthread_threadid_np(NULL, &tid64);
              return static_cast<unsigned int>(tid64);
            }
        }

Looks redundant.

@SergiusTheBest SergiusTheBest added this to the 1.1.1 milestone Jan 10, 2017
@hutch
Copy link
Contributor Author

hutch commented Jan 10, 2017

True. Maybe it's just a coding practice from my history. The idea is to try to keep everything as local as possible to minimise the necessity of mentally trying to figure out what the function looks like.

Your call, takes 30s to change. I can do that when I check OS X 10.11 tomorrow, or manage to confirm that pthread_threadid_np does date back to OS X 10.6

@hutch
Copy link
Contributor Author

hutch commented Jan 10, 2017

Found some code released with OS X 10.7 (and it says pthread_threadid_np was added in 10.6). This puts it as having been introduced in 2009.

10.6 (2009). Don't need to support that far back.
@SergiusTheBest SergiusTheBest merged commit 787b285 into SergiusTheBest:master Jan 10, 2017
@SergiusTheBest
Copy link
Owner

Looks good. I wish macOS had better documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants