[Vortex] Vortex listeners and threads
Philip Kovacs
kovacsp3 at comcast.net
Mon Jun 12 20:26:48 CEST 2006
Francis Brosnan Blazquez wrote:
> Another way to stop a server is to call to vortex_listener_unlock, which
> will produce the caller to vortex_listener_wait to be unblocked, then
> perform all resource deallocation (of your application) and then call to
> vortex_exit.
>
>
Let's assume I have an application that starts 5 listeners on 5 ports.
At some later time, I wish
to stop only one of those listeners, but keep running the other 4. Is
that possible? I don't
wish to call vortex_exit, I just wish to stop a listener and continue
with the others. Note
that this is not a real scenario, I just wish to know if it's possible,
i.e. starting and stopping
listeners "dynamically."
Another question I have is this: is there any need to start a listener
on a separate thread?
I am specifically interested in situation where the application is
operating both as a client
and a server. Should I start those listeners on a thread if I want to
use the main thread
for other purposes?
> However, in serious SO, you don't really need to call to vortex_exit,
> mainly because your kernel will get all memory allocated by your
> application, even if you didn't deallocate it. vortex_exit function only
> deallocates all memory used by Vortex Library.
>
>
I know that all application resources are freed when a process
terminates. Let's move on.
>> In the example server code, the
>> vortex_exit()
>> function, although indicated, is never really executed, correct?
>>
>> // use this thread, since no on_ready() indicated.
>> vortex_listener_new ("0.0.0.0", "3000", NULL, NULL);
>>
>> // this is the last executed program statement, right?
>> vortex_listener_wait();
>>
>> // never executed
>> vortex_exit ();
>>
>
> It is always executed. However, it could happen that a previous call to
> vortex_exit have already done, in another thread, doing the vortex
> shutdown process, so the next call to vortex_exit does nothing.
>
>
You are speaking hypothetically and I was asking about the specific
example above. In this code
above (taken from the documentation), once the vortex_listener_wait()
is executed, the program
will not execute the next vortex_exit (). The little server program
must be stopped with CNTL-C,
or killed.
Thanks
Phil
More information about the Vortex
mailing list