Tony Wang
Tony Wang
CC#
Created by Tony Wang on 6/10/2024 in #help
Application looking in wrong runtimes/{arch}/native directory
I have an application, that uses native code saved copied by its nuget into runtimes/ubuntu-x64/native directory. When I try to run it, it looks into the folder linux-x64 instead. My workaround is to just copy the contents, which works so far. But I am wondering, if I can somehow inform the program during building to look into the other directory instead
14 replies
CC#
Created by Tony Wang on 5/28/2024 in #help
Synchronizing with Monitor
I have found a code snippet that looks like this: var signal = new object(); var signalSet = false; // Thread 1 lock (signal) { while (!signalSet) { Monitor.Wait(signal); } } // Thread 2 lock (signal) { signalSet = true; Monitor.Pulse(signal); } I am confused about the while loop. What does it accomplish? Does a simple "if" do the same here? Found at: https://stackoverflow.com/questions/1355398/monitor-vs-waithandle-based-thread-sync
1 replies
CC#
Created by Tony Wang on 5/27/2024 in #help
Barrier.SignalAndWait
I am using Barriers to synchronize between threads. The PostPhaseAction is quite useful and I am wondering, if there is a similar option to invoke a method once, but when the first participant reaches the barrier instead of the last
1 replies
CC#
Created by Tony Wang on 5/27/2024 in #help
Monitor Signaling
I have some code where someone used the Monitor Class to signal between two threads. It looks very similar to the code in the top reply in: https://stackoverflow.com/questions/1355398/monitor-vs-waithandle-based-thread-sync I am planning to convert the code using EventWaitHandle instead, but I want to understand the solution first and I have troubles understanding why they used "while (!signalSet)" instead of "if(!signalSet)". Is there a difference in that case? if yes, what is the difference and if no, is there any reason to write while?
1 replies
CC#
Created by Tony Wang on 5/13/2024 in #help
HttpListenerResponse
I am using a .net HttpClient and HttpListener to communicate between two machines. I have trouble configuring the httpListenerResponse correctly. Whatever I tried so far, the HttpReponseMessage that my HttpClient receives always has an empty ContentEncoding header. I need to somehow communicate the encoding of the response back to the client. I could also use the request encoding as a workaround but I would rather avoid that
20 replies
CC#
Created by Tony Wang on 5/10/2024 in #help
HttpResponseMessage.Content.Header.ContentEncoding is empty
Hello, I am working with the .net HttlClient and have troubles setting up the response message correctly. I use the httpListener to process the request and send the response. To create and send the response I use the HttpListenerContext.Response Object. I set the Content Encoding via HttpListenerContext.Response.Encoding, and write the content to the output stream. I can send requests to my server and they are processes correctly, but the ContentEncoding header is empty in the response message that I receive with my client. I am not sure what I am doing wrong.
1 replies
CC#
Created by Tony Wang on 4/19/2024 in #help
C# IEnumerable ToArray() Benchmark
No description
48 replies