You've already forked lidgren-network-gen3
mirror of
https://github.com/lidgren/lidgren-network-gen3.git
synced 2026-05-06 02:11:06 +09:00
throw explanatory exception if trying to register callback with no sycnhronizationcontext
This commit is contained in:
@@ -46,6 +46,8 @@ namespace Lidgren.Network
|
||||
/// </summary>
|
||||
public void RegisterReceivedCallback(SendOrPostCallback callback)
|
||||
{
|
||||
if (SynchronizationContext.Current == null)
|
||||
throw new NetException("Need a SynchronizationContext to register callback on correct thread!");
|
||||
if (m_receiveCallbacks == null)
|
||||
m_receiveCallbacks = new List<NetTuple<SynchronizationContext, SendOrPostCallback>>();
|
||||
m_receiveCallbacks.Add(new NetTuple<SynchronizationContext, SendOrPostCallback>(SynchronizationContext.Current, callback));
|
||||
|
||||
Reference in New Issue
Block a user