Hello, I have created an simple web server, leveraging .NET HttpListener class. I am using ThreadPool.QueueUserWorkItem() to spawn a thread to listen to incoming requests. Threaded method uses HttpListener.BeginGetContext(callback, listener), and in callback method I resume with HttpListener.EndGetContext() as well as raise an even to notify UI that listener received data. This is the question - how to raise that event?
Initially I used ThreadPool:
ThreadPool.QueueUserWorkItem(state => ReceivedRequest(httpListenerContext, receivedRequestArgs));
But then started to doubt, maybe it should be a dedicated thread (as appose to waiting for a thread from pool):
new Thread(() => ReceivedRequest(httpListenerContext, receivedRequestArgs)).Start();
Thoughts? 10X