Xyris  0.5
__cxxabiv1 Namespace Reference

Data Structures

struct  cxaguard
 

Typedefs

typedef typedef__extension__ struct cxaguard __guard
 

Functions

int __cxa_guard_acquire (__guard *g)
 
void __cxa_guard_release (__guard *g)
 
void __cxa_guard_abort (__guard *g)
 

Variables

Mutex cxaGuard ("cxaguard")
 

Detailed Description

Special thanks to the LLVM maintainers and Apple for their fantastic comments explaining what these functions are supposed to do, as well as providing implementation inspiration. See the link at the top of this source file for details.

Typedef Documentation

◆ __guard

typedef typedef__extension__ struct cxaguard __cxxabiv1::__guard

Definition at line 73 of file gcc.cpp.

Function Documentation

◆ __cxa_guard_abort()

void __cxxabiv1::__cxa_guard_abort ( __guard g)

Definition at line 135 of file gcc.cpp.

136 {
137  cxaGuard.unlock();
138  cxaGuardSetNotInUse(g);
139 }
+ Here is the call graph for this function:

◆ __cxa_guard_acquire()

int __cxxabiv1::__cxa_guard_acquire ( __guard g)

Definition at line 108 of file gcc.cpp.

109 {
110  if (cxaGuardHasInitializerRun(g)) {
111  return 0;
112  }
113 
114  cxaGuard.lock();
115  // Ensure another thread didn't beat us to the chase
116  if (cxaGuardHasInitializerRun(g)) {
117  cxaGuard.unlock();
118  return 0;
119  }
120 
121  if (cxaGuardIsInUse(g)) {
122  panicf("[%s] __guard in bad state", __func__);
123  }
124 
125  cxaGuardSetInUse(g);
126  return 1;
127 }

◆ __cxa_guard_release()

void __cxxabiv1::__cxa_guard_release ( __guard g)

Definition at line 129 of file gcc.cpp.

130 {
131  cxaGuardSetInitializeHasRun(g);
132  cxaGuard.unlock();
133 }

Variable Documentation

◆ cxaGuard

Mutex __cxxabiv1::cxaGuard("cxaguard")

All static object initializations are protected by the single, global, recursive mutex. The recursive mutex is apparently required to enable nested objects initialization

FIXME: This needs to be a recursive lock when those are added

Mutex::unlock
bool unlock()
Release the mutex.
Definition: Mutex.cpp:38
Mutex::lock
bool lock()
Aquire the mutex.
Definition: Mutex.cpp:20
panicf
void panicf(const char *fmt,...)
Halt the system and print the provided message and arguments on the panic screen.
Definition: Panic.cpp:87
__cxxabiv1::cxaGuard
Mutex cxaGuard("cxaguard")