Re: Preferred portable way to talk to a server process

Julien R Pierre - Sun Microsystems <[email protected]>
Newsgroups gmane.comp.mozilla.devel.nspr
Message-ID <[email protected]>
Joachim,

Joachim Ziegler wrote:
> A second question: A typical server process blocks in a PR_Accept(), 
> waiting for clients to connect.
> 
> The reference page says: "PR_Accept blocks the calling thread until 
> either a new connection is successfully accepted or an error occurs."
> Now suppose that I want to shutdown the server process. How can I do 
> that? How can I make the process unblock and test a Boolean shutdown 
> variable? (Even with using signal, this would not not work according to 
> the text cited above.)

PR_Accept also takes a timeout argument. You may try using that to allow 
the function to return and do your shutdown afterwards.

Another option if you don't want to use a timeout is to use 
PR_Interrupt. You'll need the PRThread pointer of all the threads that 
are in PR_Accept, or in other NSPR blocking calls.

> 
> BTW, what's the definite reference for NSPR (yes, I am a newbie):
> 
> http://www.mozilla.org/projects/nspr/
> 
> or
> 
> http://developer.mozilla.org/en/docs/NSPR_API_Reference (the wiki)
> 

The later one is newer.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.