Remoting - Threading

A

Antimon

Hi,

I have a single threaded server application except for async socket
methods.
Anyway, i need to host some remote objects but remoting mechanism
spawns new threads for remote calls. I don't know about .net threading
too much. On the sockets part, i can send a response with a delay, so i
can exchange info with main thread using queues, generate a response on
main thread and send it. But i need to do something to block client if
i try to use remoting same way. Maybe with something like
SynchronizedQueue in java.

Any solutions?

Thanks.
 
J

Jon Skeet [C# MVP]

Antimon said:
I have a single threaded server application except for async socket
methods.
Anyway, i need to host some remote objects but remoting mechanism
spawns new threads for remote calls. I don't know about .net threading
too much. On the sockets part, i can send a response with a delay, so i
can exchange info with main thread using queues, generate a response on
main thread and send it. But i need to do something to block client if
i try to use remoting same way. Maybe with something like
SynchronizedQueue in java.

Any solutions?

I'm not sure, but it sounds like you could be after a producer/consumer
queue.
See http://www.pobox.com/~skeet/csharp/threads/deadlocks.shtml
(second half of the page).

The main thread would be consuming the messages generated on the worker
threads.

It's not entirely clear to me how this would help you though.

You might want to look into implementing ISynchronizeInvoke so that
other threads could effectively run arbitrary delegates on the main
thread.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top