On Sep 20, 2010, at 8:51 AM, Oleg Krupnov <oleg.krup...@gmail.com> wrote:

> Hi,
> 
> I have a main process and an auxiliary process that vends
> NSDistantObject to do some job for the main process upon request. In
> other words, the main process is a client, and the auxiliary process
> is a server. I have been able to implement this when there is only one
> thread in the client process.
> 
> Now I need to have multiple threads in the client process. Each client
> thread must run concurrently with other client threads, so that if two
> or more client threads request the server process at the same time,
> they should not block waiting for each other. In other words, the
> server should probably create a thread for each client thread.

Multithreading is not a prerequisite for serving multiple clients. Depending on 
what your server's doing, sticking with NSRunLoop-based multiplexing might be a 
lot easier.

> 
> What is the best way to do this? It's not clear how to vend multiple
> NSDistantObjects for multiple client threads, and spawning multiple
> auxiliary processes for each client thread would be a nightmare...

The NSConnection documentation has a bunch of methods for dealing with multiple 
threads.

In your case, though, it sounds like you only want to vend one object through 
which all your clients communicate. Even if that communication is achieved by 
asking the vended object for another object with which to communicate.

--Kyle Sluder_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to