[Vortex] Vortex listeners and threads
Francis Brosnan Blazquez
francis at aspl.es
Tue Jun 13 08:11:48 CEST 2006
El lun, 12-06-2006 a las 14:26 -0400, Philip Kovacs escribió:
> 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."
Currently, there is no way to stop a particular listener. I've filled a
bug report [1].
>
> 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?
You can perform a call to vortex_listener_new in any thread at any time
(including the main thread).
> >> 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
No, I wasn't. The example above only shows that a listener is created,
and the calling thread is blocked by vortex_listener_wait. Taking the
example, without any other reference to the complete example and its
context, nothing shows that the last sentence won't be executed, as I
explained.
Cheers,
--
Francis Brosnan Blazquez <francis at aspl.es>
Advanced Software Production Line, S.L.
More information about the Vortex
mailing list