Deadlock when combining app domain remoting and tasks

后端 未结 1 764
不思量自难忘°
不思量自难忘° 2021-02-07 10:55

My app needs to load plugins into separate app domains and then execute some code inside of them asynchronously. I\'ve written some code to wrap Task in marshallabl

1条回答
  •  我在风中等你
    2021-02-07 11:27

    My best guess is that you are facing these issues because of the async method that contains await and this is managed via the ThreadPool which can allocate some recycled Thread.

    Reference Best practice to call ConfigureAwait for all server-side code

    Actually, just doing an await can do that(put you on a different thread). Once your async method hits an await, the method is blocked but the thread returns to the thread pool. When the method is ready to continue, any thread is snatched from the thread pool and used to resume the method.

    Try to streamline the code, generate threads for baseline cases and performance is last.

    0 讨论(0)
提交回复
热议问题