synchronizationcontext Questions
4
Solved
I'm trying to learn more about the SynchronizationContext, so I made this simple console application:
private static void Main()
{
var sc = new SynchronizationContext();
SynchronizationContext.S...
Pappus asked 7/10, 2018 at 8:43
2
Solved
From what I know, AspNetCore doesn't have SynchronizationContext .
That “re-entering” the request context involves a number of
housekeeping tasks, such as setting HttpContext.Current and the
c...
Eohippus asked 29/7, 2019 at 20:17
2
Solved
Consider the following code of windows forms:
private async void UpdateUIControlClicked(object sender, EventArgs e)
{
this.txtUIControl.Text = "I will be updated after await - i hope!";
...
Bidden asked 8/1, 2015 at 22:57
1
Solved
It is generally recommended to use ConfigureAwait(false) when awaiting async calls when context is not required. Just wondering is there any benefit of using ConfigureAwait(false) in Azure Function...
Svetlana asked 5/4, 2019 at 19:15
2
I am getting intermittent deadlocks when using HttpClient to send http requests and sometimes they are never returning back to await SendAsync in my code. I was able to figure out the thread handli...
Humfrey asked 16/3, 2018 at 0:9
5
Solved
I can't work out how to get the SynchronizationContext of a given Thread:
Thread uiThread = UIConfiguration.UIThread;
SynchronizationContext context = uiThread.Huh?;
Why would I need that?
Because...
Outfox asked 5/11, 2010 at 15:41
2
Solved
I created a simple WebApi project with a single controller and a single method:
public static class DoIt
{
public static async Task<string> GetStrAsync(Uri uri)
{
using (var client = new ...
Outdoor asked 29/6, 2017 at 0:12
2
Solved
I'm trying to find out what is the difference between the SemaphoreSlim use of Wait and WaitAsync, used in this kind of context:
private SemaphoreSlim semaphore = new SemaphoreSlim(1);
public asyn...
Angkor asked 1/6, 2017 at 11:4
1
Solved
There are a couple of things (but 1 main thing) that I don't understand about the behavior of the following code.
Can someone help explain this?
It's actually pretty simple code - just one regul...
Outbrave asked 20/4, 2017 at 1:11
2
Solved
await does not guarantee continuation on the same task for spawned tasks:
private void TestButton_Click(object sender, RoutedEventArgs e)
{
Task.Run(async () =>
{
Debug.WriteLine("running on...
Chic asked 13/3, 2017 at 8:45
3
Solved
Suppose I have written a library which relies on async methods:
namespace MyLibrary1
{
public class ClassFromMyLibrary1
{
public async Task<string> MethodFromMyLibrary1(string key, Func&l...
Yakut asked 23/8, 2016 at 16:5
1
I have a custom framework where a host application runs an event loop and loads a guest application into a separate app-domain. The guest application has means to take advantage of the event loop v...
Gretchengrete asked 27/2, 2015 at 5:32
2
Solved
I'm reading up on SynchronizationContext and trying to make sure I'm not messing anything up by trying to flow the OperationContext to all threads, even after an await call.
I have this Synchroniz...
Fairminded asked 10/7, 2014 at 22:56
1
https://msdn.microsoft.com/en-us/magazine/gg598924.aspx
It's a great article, and I'm aware that all details could not be covered because that would essentially involve pasting the source code of ...
Ric asked 29/11, 2015 at 15:52
3
Solved
There are lots of guidelines for when to use ConfigureAwait(false), when using await/async in C#.
It seems the general recommendation is to use ConfigureAwait(false) in library code, as it rarely ...
Fabricate asked 4/5, 2015 at 17:42
1
Solved
Consider this WinForms program:
Module Main
Dim notifyicon As New System.Windows.Forms.NotifyIcon
'Dim dummycontrol As New System.Windows.Forms.Control
Public Sub Main()
If (System.Threading....
Verboten asked 30/4, 2015 at 10:25
1
Solved
After reading Stephen Toub's article on SynchronizationContext I'm left with a question about the output of this piece of .NET 4.5 code:
private void btnDoSomething_Click()
{
LogSyncContext("btnD...
Functionary asked 1/4, 2015 at 7:46
2
Solved
Lets looks at some simple C# async/await code where I have an object reference (obj) before and after an await with ConfigureAwait(false)
private async Task<SomeObject> AnAsyncLibraryMethod(...
Counterattack asked 25/3, 2015 at 22:51
1
Solved
I'm trying to learn about SynchronizationContext and friends.
If I set a custom synchronization context at the start of e.g. a console app.
Under what conditions will the current synchronization co...
Idiophone asked 1/12, 2014 at 13:7
1
Solved
As far as I know, there isn't a synchronization context in a Windows Service application.
Does await fooTask.ConfigureAwait(false) give me any benefits in Windows Services?
Are there any pitfal...
Quintanilla asked 7/5, 2014 at 8:26
3
I have an async method I am using to offload a few seconds' worth of fire-and-forget work so as not to slow down my page load. This work needs a bit of general setup and tidy-up; I want the (fast) ...
Aubervilliers asked 18/3, 2014 at 15:0
2
Solved
I've just noticed that with .NET 4.5 each Dispatcher.BeginInvoke/InvokeAsync callback is executed on its own very unique Synchronization Context (an instance of DispatcherSynchronizationContext). W...
Garvin asked 6/3, 2014 at 7:6
1
Let's say I have this code
ThreadPool.QueueUserWorkItem(unused =>
{
SynchronizationContext.SetSynchronizationContext(
new MyCustomSynchronizationContext());
// not reset back to null
}, ...
Iquique asked 26/2, 2014 at 5:2
1
Solved
I construct a task manually:
var task = new Task(() =>
Debug.WriteLine("Task"));
Then start it manually:
task.Start(TaskScheduler.FromCurrentSynchronizationContext());
I expect it to be ...
Hydroelectric asked 20/2, 2014 at 13:37
2
My team is developing a multi-threaded application using async/await in C# 5.0. In the process of implementing thread synchronization, after several iterations, we came up with a (possibly novel?) ...
Brigidabrigit asked 8/1, 2014 at 15:25
1 Next >
© 2022 - 2024 — McMap. All rights reserved.