On Mon, Nov 01, 2010 at 11:50:01AM -0600, Eric Blake wrote: > On 11/01/2010 10:11 AM, Daniel P. Berrange wrote: > > The current remote driver code for streams only supports > > blocking I/O mode. This is fine for the usage with migration > > but is a problem for more general use cases, in particular > > bi-directional streams. > > > > This adds supported for the stream callbacks and non-blocking > > I/O. with the minor caveat is that it doesn't actually do > > non-blocking I/O for sending stream data, only receiving it. > > A future patch will try to do non-blocking sends, but this is > > quite tricky to get right. > > > > * src/remote/remote_driver.c: Allow non-blocking I/O for > > streams and support callbacks > > > + > > +static void > > +remoteStreamEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque) > > +{ > > + virStreamPtr st = opaque; > > + struct private_data *priv = st->conn->privateData; > > + struct private_stream_data *privst = st->privateData; > > + > > + remoteDriverLock(priv); > > + if (privst->cb && > > + (privst->cbEvents & VIR_STREAM_EVENT_READABLE) && > > + privst->incomingOffset) { > > + virStreamEventCallback cb = privst->cb; > > + void *cbOpaque = privst->cbOpaque; > > + virFreeCallback cbFree = privst->cbFree; > > + > > + privst->cbDispatch = 1; > > + remoteDriverUnlock(priv); > > + (cb)(st, VIR_STREAM_EVENT_READABLE, cbOpaque); > > Any reason you aren't using the simpler style? > > cp(st, ...); I prefer the '(cb)(st...)' style, because it makes it clearer that 'cb' is not a function name, but a function pointer. Regards, Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://deltacloud.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list