Skip to content

Looking for info on making a Windows console server work using Unity and its threading #1

@MostHated

Description

@MostHated

Hey there,
I apologize in advance for the length that this question may become but I have a Windows console server application that uses things like ThreadPool, message Fibers, etc and I am trying to get it to work with Unity properly so that I can compile it as a Linux headless server instead of being tied to Windows. It uses this fiber framework and is quite complex, with a fairly large amount of interfaces and files associated with it that use things like Enqueue, IExecutor, Execute, toExecute, DispatchAdapter. Unfortunately, I am just not familiar enough with threading to be able to figure out exactly how to accomplish what I am after.

I was able to get a test working using a dispatcher I found called UnityMainThreadDispatcher. There was a place that used the call of "this.requestFiber.Enqueue(Method);" to, of course, queue up a method to run but when I would run the server within Unity it would not do anything once it ran it, so I took the Dispatcher UMTD and just swapped it out for UnityMainThreadDispatcher.Instance().Enqueue(Method); and it worked. The only issue is, that was one single thing out of many, many places in which call Enqueue and I think that it kind of defeated the purpose of the whole fiber and enqueue system to begin with by simply sending that one particular thing out to be processed.

Because the system is rather complex I figured that using something a bit more feature-filled and comprehensive such as your UnityThreading might help, I am just unfortunately not sure where I should start or what things I should try to replace of what it currently uses with the Methods UnityTheading provides. What I am trying to figure out / find information on is, in a system that uses Execute, ThreadPool, ThreadFiber, etc, is there a specific place I can / should swap out for UnityThreading to handle anything that is sent to be Enqueued so that I am not trying to go through the code and find everything that uses the Enqueue method and changing it individually or is that actually what I should do? I could technically just do a Find / Replace on anything using the current Enqueue method, but that seems like it would not work well because of the "this.requestFiber.Enqueue" part of the call that are specific to the instance of that particular class. so I am guessing it ends up needing to be something farther down the line that needs to be replaced.

I am hoping that perhaps you might be able to give me an opinion or any info you might have? This is the very last part I need to get working in my game framework to finally be able to move on with my development, I have spent 2 months straight working on it and I am so close, yet I can't find any info on how to make this work the way I need. : (

Any assistance would be extremely appreciated!
Thanks,
-MH

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions