GlaireDaggers / Netcode.IO.NET

A pure managed C# implementation of the Netcode.IO spec
MIT License
256 stars 48 forks source link

Not sure how to get a hold of you #10

Open levonravel opened 7 years ago

levonravel commented 7 years ago

How are you getting your events from the background process to the main thread? I have been having a hard time wrapping my head around this and it looks as though your doing just this.

GlaireDaggers commented 6 years ago

Sorry for not responding, I have been fairly busy lately. As far as getting events over to the main thread, I've always just used a thread-safe message pump pattern for this. A thread-safe queue lies at the core of this, so that your networking thread enqueues messages it receives onto this queue, and then your main thread at some interval dequeues all messages on this queue and processes them.

levonravel commented 6 years ago

I figured it out after some time. Ill have to show you my solution once its finished sometime over the weekend. Thank you for your response.

-levon

Sent from Outlook


From: KillaMaaki notifications@github.com Sent: Wednesday, November 1, 2017 10:48:58 AM To: KillaMaaki/Netcode.IO.NET Cc: levonravel; Author Subject: Re: [KillaMaaki/Netcode.IO.NET] Not sure how to get a hold of you (#10)

Sorry for not responding, I have been fairly busy lately. As far as getting events over to the main thread, I've always just used a thread-safe message pump pattern for this. A thread-safe queue lies at the core of this, so that your networking thread enqueues messages it receives onto this queue, and then your main thread at some interval dequeues all messages on this queue and processes them.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/KillaMaaki/Netcode.IO.NET/issues/10#issuecomment-341184915, or mute the threadhttps://github.com/notifications/unsubscribe-auth/ALOAc1kX3vlV02yhky12S8Kia5iLCxNQks5syK8FgaJpZM4P8xZL.