[libc-commits] [libc] [libc] make integration test malloc work properly when threaded (PR #151622)
    Joseph Huber via libc-commits 
    libc-commits at lists.llvm.org
       
    Thu Jul 31 19:48:46 PDT 2025
    
    
  
https://github.com/jhuber6 requested changes to this pull request.
Does `fetch_add` not work here? 
```c
void *naive_bump(size_t s) {    
  s = ((s + ALIGNMENT - 1) / ALIGNMENT) * ALIGNMENT;    
  void *mem = __scoped_atomic_fetch_add(&bump_ptr, s, __ATOMIC_RELAXED,    
                                        __MEMORY_SCOPE_DEVICE);    
  return (uint8_t *)mem + s - memory >= MEMORY_SIZE ? nullptr : mem;    
}
```
https://github.com/llvm/llvm-project/pull/151622
    
    
More information about the libc-commits
mailing list