| 131 | |
| 132 | JEMALLOC_ATTR(constructor) |
| 133 | static void WINAPI |
| 134 | _init_init_lock(void) { |
| 135 | /* |
| 136 | * If another constructor in the same binary is using mallctl to e.g. |
| 137 | * set up extent hooks, it may end up running before this one, and |
| 138 | * malloc_init_hard will crash trying to lock the uninitialized lock. So |
| 139 | * we force an initialization of the lock in malloc_init_hard as well. |
| 140 | * We don't try to care about atomicity of the accessed to the |
| 141 | * init_lock_initialized boolean, since it really only matters early in |
| 142 | * the process creation, before any separate thread normally starts |
| 143 | * doing anything. |
| 144 | */ |
| 145 | if (!init_lock_initialized) { |
| 146 | malloc_mutex_init(&init_lock, "init", WITNESS_RANK_INIT, |
| 147 | malloc_mutex_rank_exclusive); |
| 148 | } |
| 149 | init_lock_initialized = true; |
| 150 | } |
| 151 | |
| 152 | #ifdef _MSC_VER |
| 153 | # pragma section(".CRT$XCU", read) |
no test coverage detected