c# - Coroutine call crashes -


i'm getting strange crashes:

exception type:  exc_bad_access (sigabrt) exception codes: kern_invalid_address @ 0x00000004 crashed thread:  0  thread 0 name:  dispatch queue: com.apple.main-thread thread 0 crashed: 0   libsystem_kernel.dylib          0x3b1cc350 __pthread_kill + 8 1   libsystem_c.dylib               0x3b14311e pthread_kill + 54 2   libsystem_c.dylib               0x3b17f96e abort + 90 3   _example                        0x0161cd74 mono_handle_native_sigsegv + 312 4   _example                        0x0160c6e4 mono_sigsegv_signal_handler + 256 5   libsystem_c.dylib               0x3b14ce90 _sigtramp + 40 6   _example                        0x01707114 g_hash_table_lookup_extended + 172 7   _example                        0x01707154 g_hash_table_lookup + 20 8   _example                        0x016a3144 mono_metadata_parse_type_full + 636 9   _example                        0x016a2e70 mono_metadata_parse_generic_inst + 88 10  _example                        0x016a34bc do_mono_metadata_parse_type + 768 11  _example                        0x016a3abc mono_type_create_from_typespec + 216 12  _example                        0x0164ee70 mono_type_retrieve_from_typespec + 32 13  _example                        0x016464bc mono_class_get_full + 208 14  _example                        0x01677fc4 method_from_memberref + 276 15  _example                        0x016774a4 mono_get_method_from_token + 688 16  _example                        0x01677140 mono_get_method_full + 176 17  _example                        0x01677754 mono_get_method + 12 18  _example                        0x01613554 decode_patch + 412 19  _example                        0x016161f8 mono_aot_plt_resolve + 244 20  _example                        0x0161e518 mono_aot_plt_trampoline + 32 21  _example                        0x00dd33d8 generic_trampoline_6 + 120 22  _example                        0x0124b0a8 scripting_method_invoke(scriptingmethod*, monoobject*, scriptingarguments&, monoexception**) (scriptingbackendapi_mono.cpp:180) 23  _example                        0x012ceed0 scriptinginvocation::invoke(monoexception**, bool) (scriptinginvocation.cpp:113) 24  _example                        0x012cee9c scriptinginvocation::invoke(monoexception**) (scriptinginvocation.cpp:98) 25  _example                        0x012cee48 bool scriptinginvocation::invoke<bool>(monoexception**) (scriptinginvocation.cpp:72) 26  _example                        0x012b2548 coroutine::invokemovenext(monoexception**) (coroutine.cpp:180) 27  _example                        0x012b229c coroutine::run() (coroutine.cpp:205) 28  _example                        0x012c4f6c monobehaviour::createcoroutine(monoobject*, scriptingmethod*) (monobehaviour.cpp:786) 29  _example                        0x012c51f0 monobehaviour::startcoroutinemanaged2(monoobject*) (monobehaviour.cpp:824) 30  _example                        0x0144f89c monobehaviour_custom_startcoroutine_auto(readonlyscriptingobjectoftype<monobehaviour>, monoobject*) (unityenginemonobehaviour.cpp:78) 31  _example                        0x00b6745c m_unityengine_monobehaviour_startcoroutine_system_collections_ienumerator + 40 

they happen in same place 20% of time on 4s ios 6, wasn't able reproduce them on iphone 5 ios 7.

in code, i'm trying call coroutine, looks this:

ienumerator somecoroutine(system.action<bool> _success) {     #if unity_iphone     nativeobjectivecmethod();     #elif unity_android     // ... else, not relevant here     #endif     while(m_privatefieldsetinotherthread == null)     {         yield return null;     }      if (_success != null)     {         _success(m_privatefieldsetinotherthread.value);     }     m_privatefieldsetinotherthread = null;  } 

i don't understand crash.

clarification: field gets set in other thread because call originates third-party api on native level.

unity's api not thread safe can't used thread. unity have implemented thread-check prevent trying use thread.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -