mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
-----BEGIN PGP SIGNATURE-----
iQIcBAABCAAGBQJan8v5AAoJEL6G67QVEE/ffDwP/1iXeZZXTvyztiuQaP495JQl 1e9FChjhB+2eeLuBTZHZrxIM89aoBCHtQ8sPsWDShrdSy5REROr6CX696vyaI/wK R72LQ+FuyOmeIASOdAqC7xETSP8f88VvfI4YOtOYHTmIMvMh+Uz1DJAgqI9E5Zbp sX2BIg43qqJRaRimyihRpEkmvuV/djd4FpBC1G8r8+tv3jH2tJJ9dhhLwAUkJf34 j3IIEqw3jhl13K1RDCgAqYovcD5sRZMgoaoD+JXxU+r0IBw5Dz9a9sQ19RzAZNaK sbjdgTCG7yQ0JOMOKoRDcHdCQvXLE2XhyPHvbrZ/d4nTcpZN4H9EpuDBL7PrR6kp c3q5Uff1UC2EBc3frJ+si27B3b/RKdDXXy6Ocb/BL2aivcVwjZlhuHPrfpR97NEL ONICf9OW3j1y6vHRTUMmpkEG71MHD26S6oZKljuGAgc8mjwTI7XwiU66R1+0R7b8 YuXoHthPlWrKQgnVO7V6c/1YzV7mxjRqvPxvR6Flox/P0wxKPzC1K7UH7qxlhJEW xydPiBoaXZySa5M1eScwxaU2bap+zeBQTkjmJ2wpqH6OPwzKwBNLYHus78bIrQFI vVq8ukZeJYvLlvu4lhoQoSZM1Im6GFI2Pj65sovDuJqZ+clzqJdmI/1OzZimqSgi bIX+8GhilfZR+Gji3Sb1 =dBv4 -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/berrange/tags/qio-next-pull-request' into staging # gpg: Signature made Wed 07 Mar 2018 11:24:41 GMT # gpg: using RSA key BE86EBB415104FDF # gpg: Good signature from "Daniel P. Berrange <dan@berrange.com>" # gpg: aka "Daniel P. Berrange <berrange@redhat.com>" # Primary key fingerprint: DAF3 A6FD B26B 6291 2D0E 8E3F BE86 EBB4 1510 4FDF * remotes/berrange/tags/qio-next-pull-request: qio: non-default context for TLS handshake qio: non-default context for async conn qio: non-default context for threaded qtask qio: store gsources for net listeners qio: introduce qio_channel_add_watch_{full|source} qio: rename qio_task_thread_result Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
3ef91576b9
21 changed files with 242 additions and 65 deletions
|
@ -101,6 +101,8 @@ int qio_channel_socket_connect_sync(QIOChannelSocket *ioc,
|
|||
* @callback: the function to invoke on completion
|
||||
* @opaque: user data to pass to @callback
|
||||
* @destroy: the function to free @opaque
|
||||
* @context: the context to run the async task. If %NULL, the default
|
||||
* context will be used.
|
||||
*
|
||||
* Attempt to connect to the address @addr. This method
|
||||
* will run in the background so the caller will regain
|
||||
|
@ -113,7 +115,8 @@ void qio_channel_socket_connect_async(QIOChannelSocket *ioc,
|
|||
SocketAddress *addr,
|
||||
QIOTaskFunc callback,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
GDestroyNotify destroy,
|
||||
GMainContext *context);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -138,6 +141,8 @@ int qio_channel_socket_listen_sync(QIOChannelSocket *ioc,
|
|||
* @callback: the function to invoke on completion
|
||||
* @opaque: user data to pass to @callback
|
||||
* @destroy: the function to free @opaque
|
||||
* @context: the context to run the async task. If %NULL, the default
|
||||
* context will be used.
|
||||
*
|
||||
* Attempt to listen to the address @addr. This method
|
||||
* will run in the background so the caller will regain
|
||||
|
@ -150,7 +155,8 @@ void qio_channel_socket_listen_async(QIOChannelSocket *ioc,
|
|||
SocketAddress *addr,
|
||||
QIOTaskFunc callback,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
GDestroyNotify destroy,
|
||||
GMainContext *context);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -179,6 +185,8 @@ int qio_channel_socket_dgram_sync(QIOChannelSocket *ioc,
|
|||
* @callback: the function to invoke on completion
|
||||
* @opaque: user data to pass to @callback
|
||||
* @destroy: the function to free @opaque
|
||||
* @context: the context to run the async task. If %NULL, the default
|
||||
* context will be used.
|
||||
*
|
||||
* Attempt to initialize a datagram socket bound to
|
||||
* @localAddr and communicating with peer @remoteAddr.
|
||||
|
@ -194,7 +202,8 @@ void qio_channel_socket_dgram_async(QIOChannelSocket *ioc,
|
|||
SocketAddress *remoteAddr,
|
||||
QIOTaskFunc callback,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
GDestroyNotify destroy,
|
||||
GMainContext *context);
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -116,6 +116,8 @@ qio_channel_tls_new_client(QIOChannel *master,
|
|||
* @func: the callback to invoke when completed
|
||||
* @opaque: opaque data to pass to @func
|
||||
* @destroy: optional callback to free @opaque
|
||||
* @context: the context that TLS handshake will run with. If %NULL,
|
||||
* the default context will be used
|
||||
*
|
||||
* Perform the TLS session handshake. This method
|
||||
* will return immediately and the handshake will
|
||||
|
@ -126,7 +128,8 @@ qio_channel_tls_new_client(QIOChannel *master,
|
|||
void qio_channel_tls_handshake(QIOChannelTLS *ioc,
|
||||
QIOTaskFunc func,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
GDestroyNotify destroy,
|
||||
GMainContext *context);
|
||||
|
||||
/**
|
||||
* qio_channel_tls_get_session:
|
||||
|
|
|
@ -648,6 +648,50 @@ guint qio_channel_add_watch(QIOChannel *ioc,
|
|||
gpointer user_data,
|
||||
GDestroyNotify notify);
|
||||
|
||||
/**
|
||||
* qio_channel_add_watch_full:
|
||||
* @ioc: the channel object
|
||||
* @condition: the I/O condition to monitor
|
||||
* @func: callback to invoke when the source becomes ready
|
||||
* @user_data: opaque data to pass to @func
|
||||
* @notify: callback to free @user_data
|
||||
* @context: the context to run the watch source
|
||||
*
|
||||
* Similar as qio_channel_add_watch(), but allows to specify context
|
||||
* to run the watch source.
|
||||
*
|
||||
* Returns: the source ID
|
||||
*/
|
||||
guint qio_channel_add_watch_full(QIOChannel *ioc,
|
||||
GIOCondition condition,
|
||||
QIOChannelFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify,
|
||||
GMainContext *context);
|
||||
|
||||
/**
|
||||
* qio_channel_add_watch_source:
|
||||
* @ioc: the channel object
|
||||
* @condition: the I/O condition to monitor
|
||||
* @func: callback to invoke when the source becomes ready
|
||||
* @user_data: opaque data to pass to @func
|
||||
* @notify: callback to free @user_data
|
||||
* @context: gcontext to bind the source to
|
||||
*
|
||||
* Similar as qio_channel_add_watch(), but allows to specify context
|
||||
* to run the watch source, meanwhile return the GSource object
|
||||
* instead of tag ID, with the GSource referenced already.
|
||||
*
|
||||
* Note: callers is responsible to unref the source when not needed.
|
||||
*
|
||||
* Returns: the source pointer
|
||||
*/
|
||||
GSource *qio_channel_add_watch_source(QIOChannel *ioc,
|
||||
GIOCondition condition,
|
||||
QIOChannelFunc func,
|
||||
gpointer user_data,
|
||||
GDestroyNotify notify,
|
||||
GMainContext *context);
|
||||
|
||||
/**
|
||||
* qio_channel_attach_aio_context:
|
||||
|
|
|
@ -53,7 +53,7 @@ struct QIONetListener {
|
|||
|
||||
char *name;
|
||||
QIOChannelSocket **sioc;
|
||||
gulong *io_tag;
|
||||
GSource **io_source;
|
||||
size_t nsioc;
|
||||
|
||||
bool connected;
|
||||
|
@ -119,6 +119,26 @@ int qio_net_listener_open_sync(QIONetListener *listener,
|
|||
void qio_net_listener_add(QIONetListener *listener,
|
||||
QIOChannelSocket *sioc);
|
||||
|
||||
/**
|
||||
* qio_net_listener_set_client_func_full:
|
||||
* @listener: the network listener object
|
||||
* @func: the callback function
|
||||
* @data: opaque data to pass to @func
|
||||
* @notify: callback to free @data
|
||||
* @context: the context that the sources will be bound to. If %NULL,
|
||||
* the default context will be used.
|
||||
*
|
||||
* Register @func to be invoked whenever a new client
|
||||
* connects to the listener. @func will be invoked
|
||||
* passing in the QIOChannelSocket instance for the
|
||||
* client.
|
||||
*/
|
||||
void qio_net_listener_set_client_func_full(QIONetListener *listener,
|
||||
QIONetListenerClientFunc func,
|
||||
gpointer data,
|
||||
GDestroyNotify notify,
|
||||
GMainContext *context);
|
||||
|
||||
/**
|
||||
* qio_net_listener_set_client_func:
|
||||
* @listener: the network listener object
|
||||
|
@ -126,10 +146,8 @@ void qio_net_listener_add(QIONetListener *listener,
|
|||
* @data: opaque data to pass to @func
|
||||
* @notify: callback to free @data
|
||||
*
|
||||
* Register @func to be invoked whenever a new client
|
||||
* connects to the listener. @func will be invoked
|
||||
* passing in the QIOChannelSocket instance for the
|
||||
* client.
|
||||
* Wrapper of qio_net_listener_set_client_func_full(), only that the
|
||||
* sources will always be bound to default main context.
|
||||
*/
|
||||
void qio_net_listener_set_client_func(QIONetListener *listener,
|
||||
QIONetListenerClientFunc func,
|
||||
|
|
|
@ -227,15 +227,18 @@ QIOTask *qio_task_new(Object *source,
|
|||
* @worker: the function to invoke in a thread
|
||||
* @opaque: opaque data to pass to @worker
|
||||
* @destroy: function to free @opaque
|
||||
* @context: the context to run the complete hook. If %NULL, the
|
||||
* default context will be used.
|
||||
*
|
||||
* Run a task in a background thread. When @worker
|
||||
* returns it will call qio_task_complete() in
|
||||
* the main event thread context.
|
||||
* the event thread context that provided.
|
||||
*/
|
||||
void qio_task_run_in_thread(QIOTask *task,
|
||||
QIOTaskWorker worker,
|
||||
gpointer opaque,
|
||||
GDestroyNotify destroy);
|
||||
GDestroyNotify destroy,
|
||||
GMainContext *context);
|
||||
|
||||
/**
|
||||
* qio_task_complete:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue