This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++11 status.

1479. Fence functions should be extern "C"

Section: 33.5.11 [atomics.fences] Status: C++11 Submitter: INCITS Opened: 2010-08-25 Last modified: 2016-01-28

Priority: Not Prioritized

View all other issues in [atomics.fences].

View all issues with C++11 status.

Discussion:

Addresses US-179

The fence functions (33.5.11 [atomics.fences] p.5 + p.6) should be extern "C", for C compatibility.

[2011-02-16 Reflector discussion]

Moved to Tentatively Ready after 6 votes.

Proposed resolution:

  1. Change 33.5.2 [atomics.syn], header <atomic> synopsis as indicated:
    namespace std {
      [..]
      // 29.8, fences
      extern "C" void atomic_thread_fence(memory_order);
      extern "C" void atomic_signal_fence(memory_order);  
    }
    
  2. Change 33.5.11 [atomics.fences], p. 5 and p. 6 as indicated:

    extern "C" void atomic_thread_fence(memory_order);
    

    5 Effects: depending on the value of order, this operation: [..]

    extern "C" void atomic_signal_fence(memory_order);  
    

    6 Effects: equivalent to atomic_thread_fence(order), except that synchronizes with relationships are established only between a thread and a signal handler executed in the same thread.