Home Forums Support Threading

Tagged: 

  • This topic has 7 replies, 3 voices, and was last updated 11 years ago by Anonymous.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1159
    Anonymous
    Inactive

    Hi,

    Ok, I’m looking to create a multi-access service, so I’m thinking I need each of my network service handlers to fire off in a new thread.

    When NetworkCommsDotNet starts a packet handler, does it do so in a separate thread automatically, or do I need to arrange for that to happen as part of my code?

    Thank you once again for making all this so easy!

    #1160
    Anonymous
    Inactive

    “does it do so in a separate thread automatically” – yes, threading is all taken of care automatically. It all gets executed within NetworkComms.CommsThreadPool, which is a customised, priority based Threadpool. Originally we used the threadpool provided by .net but it wasn’t flexible enough.

    Marc

    #1162
    Anonymous
    Inactive

    Thank you for the response! That certainly makes things easier!

    My app will esquire additional threads, is it ok to “mix and match” or would you recommend using your thread framework entirely?

    #1163
    Anonymous
    Inactive

    It’s easier to avoid problems if you use the .net thread pool (e.g. Task.Factory).

    Regards,
    Marc

    #1175
    Anonymous
    Inactive

    Which example to learn from how to deal with Thread Safety?

    Or perhaps can you provide me with an example how you can store data into a list without loosing information when the same event is triggered at the near same time?

    #1180
    Anonymous
    Inactive

    This is a great resource on threading – http://msdn.microsoft.com/en-us/library/aa645740(v=vs.71).aspx

    Take particularly note of the section on lock statements.

    Regards,
    Marc

    #1182
    Anonymous
    Inactive

    Just using lock seems to be to slow if there are to many requests…

    now, i am rather new with C#… therefore embraced the simplicity of this network library… not having a provided solution for this facing this tough thread issue makes it kinda ironic 😉

    I realize this network library is not Unity specific… which is unfortunate for me 😉

    #1185
    Anonymous
    Inactive

    Heya Rob,

    A better resource for asking these sort of threading questions is stackoverflow.com. You can use NetworkComms.Net to easily add networking to any unity projects and should you have any questions relating to networking feel free to post back here.

    Regards,
    Marc

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.