Skip to content

Conversation

@droark
Copy link

@droark droark commented Nov 7, 2016

OSMemoryBarrier() has been deprecated as of macOS 10.12. Compile it only if on a version where it’s not deprecated.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@droark
Copy link
Author

droark commented Nov 7, 2016

Signed.

@googlebot
Copy link

CLAs look good, thanks!

@droark
Copy link
Author

droark commented Nov 7, 2016

Just FYI, this is untested beyond confirming that it compiles without warnings under 10.12. I'd imagine it'll be fine elsewhere. I just haven't tested. If I'm wrong, I'm happy to mod the patch as needed.

Thanks.

@droark droark force-pushed the master branch 2 times, most recently from 9a0eb8c to eeac956 Compare November 7, 2016 17:58
@spencerlievens
Copy link

ACK

@droark
Copy link
Author

droark commented Jan 3, 2017

Update: I finally ran all the tests and db_bench in static mode, along with db_bench in shared mode. They all passed (tests) or had what appeared to be reasonable numbers (db_bench).

Thanks.

@tmm1
Copy link

tmm1 commented Jan 18, 2017

Isn't it necessary to replace this with something else that implements the same barrier?

From the deprecation message, it seems std::atomic_thread_fence() is recommended:

./port/atomic_pointer.h:59:3: warning: 'OSMemoryBarrier' is deprecated: first deprecated in macOS 10.12 - Use std::atomic_thread_fence() from <atomic>
      instead [-Wdeprecated-declarations]
  OSMemoryBarrier();
  ^
/usr/include/libkern/OSAtomicDeprecated.h:749:9: note: 'OSMemoryBarrier' has been explicitly marked deprecated here
void    OSMemoryBarrier( void );
        ^
1 warning generated.

@droark
Copy link
Author

droark commented Jan 18, 2017

@tmm1 - Fair point. I have noticed, going through the commit history, that a couple of similar warnings were fixed in a different manner that followed what the compiler prescribed. I'll look into a solution that maintains the barrier.

Thanks.

OSMemoryBarrier() has been deprecated as of macOS 10.12. Compile it only if on a version where it’s not deprecated.
@droark
Copy link
Author

droark commented Jan 21, 2017

Added atomic_thread_fence(), as suggested by the compiler. I chose sequentially-consistent ordering, as that seemed like the most logical choice. I'm happy to change this as the LevelDB team sees fit, though.

Re-ran all the tests as mentioned above. Everything seemed fine.

@theuni
Copy link

theuni commented Feb 14, 2017

See #449, which is IMO the preferable fix.

@droark
Copy link
Author

droark commented Feb 14, 2017

@theuni - Thanks. I'll leave this open just in case but, after thinking about it, I think I prefer the fix @sipa put together.

@droark
Copy link
Author

droark commented Mar 10, 2018

Fixed here. Closing this out.

@droark droark closed this Mar 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants