Commit graph

15 commits

Author SHA1 Message Date
Henrik Böving
50cfe354be
chore: remove old LEAN_AUTO_THREAD_FINALIZATION workaround (#8885)
This PR removes an old workaround around non-implemented C++11 features
in the thread finalization.

This `ifdef` dates back to approximately 2015 as can be seen
[here](https://github.com/leanprover/lean3/blame/master/src/util/thread.cpp#L177),
the comments mention that it was originally implemented because not all
compilers at the time were able to support the C++11 `thread_local`
keyword. 10 years later this is hopefully the case and we can remove
this workaround.

There is an additional motivation for doing this,
`lean::initialize_thread` contains the following allocation:
```cpp
    g_thread_finalizers_mgr = new thread_finalizers_manager;
```
this is supposed to be freed at some point but:
```cpp
// TODO(gabriel): race condition with thread finalizers
void delete_thread_finalizer_manager() {
    // delete g_thread_finalizers_mgr;
    // g_thread_finalizers_mgr = nullptr;
}
```
so `g_thread_finalizers_mgr` leaks upon repeated invocation of
`lean::initialize_thread`.

Note that Windows has already been using this alternative implementation
for a while so the alternative implementation has (hopefully) not rotten
away in the meantime.
2025-06-20 08:52:17 +00:00
Sebastian Ullrich
87d41e6326
chore: missing include on Windows (#4919) 2024-08-05 15:50:43 +00:00
Sebastian Ullrich
3921257ece
feat: thread initialization for reverse FFI (#3632)
Makes it possible to properly allocate and free thread-local runtime
resources for threads not started by Lean itself
2024-03-07 17:02:47 +00:00
Leonardo de Moura
c8406a301d chore: reduce src/include/lean 2021-09-07 08:24:54 -07:00
Sebastian Ullrich
9dffc61e27 fix: free lthread resources on Windows 2020-09-29 08:01:10 -07:00
Leonardo de Moura
2f1ec93289 chore: move runtime implementation to src/runtime 2020-05-22 14:35:16 -07:00
Leonardo de Moura
1a77ee4f89 chore: delete old runtime directory 2020-05-18 11:33:18 -07:00
Leonardo de Moura
8bdca35282 chore: use #include <lean/runtime/...> for runtime .h files 2020-05-18 11:30:07 -07:00
Sebastian Ullrich
9fdcf6ea59 refactor: put all includes in include/lean/ 2020-05-18 11:00:26 -07:00
Sebastian Ullrich
5107403d24 feat: detect stack overflows on all platforms and threads 2020-05-04 11:11:11 +02:00
Leonardo de Moura
00af75accf chore: style
fix nonsense
2019-10-29 14:50:22 -07:00
Leonardo de Moura
4b7b95cd76 fix: missing file
LEAN_SMALL_ALLOCATOR is defined at `config.h`
2019-10-29 14:48:02 -07:00
Sebastian Ullrich
90b91760aa fix: SMALL_ALLOCATOR=OFF 2019-10-29 13:41:16 -07:00
Leonardo de Moura
5c7849a869 feat(runtime): eager heap initialization 2019-04-25 18:10:36 -07:00
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Renamed from src/util/thread.cpp (Browse further)