| 693 | } |
| 694 | |
| 695 | static |
| 696 | bool DetachCurrentThreadIfNotNative (void) |
| 697 | { |
| 698 | if (! SK_mono_thread_current) |
| 699 | { |
| 700 | if (Il2cpp::thread_detach != nullptr) |
| 701 | Il2cpp::thread_detach (Il2cpp::thread_current ()); |
| 702 | |
| 703 | return false; |
| 704 | } |
| 705 | |
| 706 | MonoThread* this_thread = |
| 707 | SK_mono_thread_current (); |
| 708 | |
| 709 | if (this_thread != nullptr) |
| 710 | { |
| 711 | // This API doesn't exist in older versions of Mono. |
| 712 | if (SK_mono_thread_is_foreign == nullptr || |
| 713 | SK_mono_thread_is_foreign (this_thread)) |
| 714 | { |
| 715 | SK_mono_thread_detach (this_thread); |
| 716 | |
| 717 | SK_LOGi1 (L"Detached Non-Native Mono Thread: tid=%x", GetCurrentThreadId ()); |
| 718 | |
| 719 | return true; |
| 720 | } |
| 721 | } |
| 722 | |
| 723 | return false; |
| 724 | } |
| 725 | |
| 726 | class SK_Mono_ScopedThreadAttach |
| 727 | { |
no outgoing calls
no test coverage detected