-
-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: #1241 - Telepathy updated to latest version. All tests are passi…
…ng again. Thread.Interrupt was replaced by Abort+Join.
- Loading branch information
Showing
9 changed files
with
64 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
namespace Telepathy | ||
namespace Telepathy | ||
{ | ||
public enum EventType | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
Assets/Mirror/Runtime/Transport/Telepathy/NetworkStreamExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System.IO; | ||
using System.IO; | ||
using System.Net.Sockets; | ||
|
||
namespace Telepathy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
Assets/Mirror/Runtime/Transport/Telepathy/ThreadExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
using System.Threading; | ||
|
||
namespace Telepathy | ||
{ | ||
public static class ThreadExtensions | ||
{ | ||
// helper function to abort a thread and not return until it's fully done | ||
public static void AbortAndJoin(this Thread thread) | ||
{ | ||
// kill thread at all costs | ||
// -> calling .Join would sometimes wait forever | ||
// -> calling .Interrupt only interrupts certain states. | ||
// => Abort() is the better solution. | ||
thread.Abort(); | ||
|
||
// wait until thread is TRULY finished. this is the only way | ||
// to guarantee that everything was properly cleaned up before | ||
// returning. | ||
// => this means that this function may sometimes block for a while | ||
// but there is no other way to guarantee that everything is | ||
// cleaned up properly by the time Stop() returns. | ||
// we have to live with the wait time. | ||
thread.Join(); | ||
} | ||
} | ||
} |