Commit e0204da8 authored by Maged Michael's avatar Maged Michael Committed by Facebook GitHub Bot

Baton and Futex: Add comments about async-signal-safety

Summary: Add comments stating the expectations for Baton post and Futex wake native implementation to be async-signal-safe.

Reviewed By: ot, luciang

Differential Revision: D33461663

fbshipit-source-id: 2855427cc94f577b566b19203a4523f54a41d0aa
parent e26fa87d
...@@ -40,6 +40,8 @@ namespace { ...@@ -40,6 +40,8 @@ namespace {
//////////////////////////////////////////////////// ////////////////////////////////////////////////////
// native implementation using the futex() syscall // native implementation using the futex() syscall
// The native implementation of futex wake must be async-signal-safe.
#ifdef __linux__ #ifdef __linux__
/// Certain toolchains (like Android's) don't include the full futex API in /// Certain toolchains (like Android's) don't include the full futex API in
...@@ -161,6 +163,8 @@ FutexResult nativeFutexWaitImpl( ...@@ -161,6 +163,8 @@ FutexResult nativeFutexWaitImpl(
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// compatibility implementation using standard C++ API // compatibility implementation using standard C++ API
// This implementation may be non-async-signal-safe.
using Lot = ParkingLot<uint32_t>; using Lot = ParkingLot<uint32_t>;
Lot parkingLot; Lot parkingLot;
......
...@@ -55,6 +55,11 @@ namespace folly { ...@@ -55,6 +55,11 @@ namespace folly {
/// DeterministicSchedule. By having a much more restrictive /// DeterministicSchedule. By having a much more restrictive
/// lifecycle we can also add a bunch of assertions that can help to /// lifecycle we can also add a bunch of assertions that can help to
/// catch race conditions ahead of time. /// catch race conditions ahead of time.
///
/// Baton post with MayBlock == false is async-signal-safe.
/// When MayBlock == true, Baton post is async-signal-safe if
/// Futex wake is so.
template <bool MayBlock = true, template <typename> class Atom = std::atomic> template <bool MayBlock = true, template <typename> class Atom = std::atomic>
class Baton { class Baton {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment