Commit 6ac1197
[2019-10] [threads] Add back mono_threads_attach_tools_thread as a public API (#18075)
* [utils] Add back mono_threads_attach_tools_thread
In a5da7b2
we got rid of "tools" threads internally to the runtime.
However since the API was previously marked with MONO_API it was an internal
API that some embedders depended on.
This PR adds back an (external-only) limited form of tools thread.
The runtime is aware of the Tools thread in that FOREACH_THREAD_* macros will
iterate over them, and the thread has a coop thread state machine. (That is,
mono_thread_info_current() and GC Safe and GC Unsafe transitions all work.)
However the thread is:
1. Not stopped by the GC
2. Is not interrupted by profiler sampling.
3. Does not have a "current domain"
4. (As a consequence of the above) cannot call managed methods or touch managed
objects.
Such threads are useful for low-level interaction with the runtime such as
querying metadata, the JIT state and other coordination.
mono_threads_attach_tools_thread should be called no more than once. It should
not be called on a thread that is already attached with mono_thread_atach, and
vice versa.
Addresses #18011
* [threads] Make mono_threads_attach_tools_thread into a public API1 parent b687667 commit 6ac1197
2 files changed
+33
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1549 | 1549 | | |
1550 | 1550 | | |
1551 | 1551 | | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
| 1557 | + | |
| 1558 | + | |
| 1559 | + | |
| 1560 | + | |
| 1561 | + | |
| 1562 | + | |
| 1563 | + | |
| 1564 | + | |
| 1565 | + | |
| 1566 | + | |
| 1567 | + | |
| 1568 | + | |
| 1569 | + | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
| 1576 | + | |
| 1577 | + | |
| 1578 | + | |
| 1579 | + | |
1552 | 1580 | | |
1553 | 1581 | | |
1554 | 1582 | | |
| |||
1559 | 1587 | | |
1560 | 1588 | | |
1561 | 1589 | | |
| 1590 | + | |
| 1591 | + | |
1562 | 1592 | | |
1563 | 1593 | | |
1564 | 1594 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
| |||
0 commit comments