Author Topic: il2cpp error on Disconnect  (Read 7255 times)

phoenix

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 3
  • Posts: 49
    • View Profile
il2cpp error on Disconnect
« on: November 18, 2015, 02:00:34 AM »
I am receiving this error when I try to stop a game server.

NotSupportedException: /Users/builduser/buildslave/unity/build/Tools/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Threading/Thread.cpp(367) : Unsupported internal call for IL2CPP:Thread::Abort_internal - "Thread abortion is currently not implemented on IL2CPP; it is recommended to use safer mechanisms to terminate threads."
  at TNet.GameServer.Stop () [0x00000] in <filename unknown>:0
  at TNServerInstance.Disconnect () [0x00000] in <filename unknown>:0

Accoring to this post, it looks like unity is not going to support Thread.Abort
http://forum.unity3d.com/threads/4-6-ios-64-bit-beta.290551/page-16

And according to this post maybe we can call interrupt instead?
http://stackoverflow.com/questions/3632149/question-about-terminating-a-thread-cleanly-in-net/3632642#3632642

Any suggestions on stopping a game server for ios il2cpp?
« Last Edit: November 18, 2015, 02:12:08 AM by phoenix »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: il2cpp error on Disconnect
« Reply #1 on: November 18, 2015, 04:29:32 PM »
That's such a silly decision on their end... ok, they don't want to support the function, fine.. why not make it default to calling Interrupt() then? Boggles my mind...

I would say change it to Interrupt() and see if it works as expected. I went through and simply did:
  1. #if UNITY_IPHONE
  2.                         mThread.Interrupt();
  3. #else
  4.                         mThread.Abort();
  5. #endif

zoon

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: il2cpp error on Disconnect
« Reply #3 on: May 29, 2016, 02:20:57 PM »
Sorry for the revisit here but needing to finish and release a product before updating to later Unitys and TNet 3, and this one's bit me in the butt. Where exactly do I make the above code changes (Using TNet 2) to enable server termination on il2cpp? Thanks

cmifwdll

  • Global Moderator
  • Sr. Member
  • *****
  • Thank You
  • -Given: 0
  • -Receive: 149
  • Posts: 285
  • TNet Alchemist
    • View Profile
Re: il2cpp error on Disconnect
« Reply #4 on: May 29, 2016, 06:29:03 PM »
If you press Ctrl+F while Visual Studio (or whatever IDE you use) has focus, it'll bring up a search button. You can adjust the search options to search through the entire solution. From there, the search term I chose was ".Abort();". I came up with 4 results:
TNTcpLobbyServer.cs - Stop() function
TNUPnP.cs - Close() function
TNGameServer.cs - Stop() function
TNUdpLobbyServer.cs - Stop() function

Shifty Geezer

  • Full Member
  • ***
  • Thank You
  • -Given: 7
  • -Receive: 9
  • Posts: 226
    • View Profile
Re: il2cpp error on Disconnect
« Reply #5 on: May 30, 2016, 03:48:15 AM »
That's sensible. I hadn't thought that I need to replace all instances of Abort().