[ovs-discuss] Fwd: Is there any possible for program blocking here for long time ?

yewgang batmanustc at gmail.com
Thu Jan 22 03:01:54 UTC 2015


Dear Developers,

Thank you. I don't know if these codes will give me faster response ? Could
I change codes like this ?

enum ovsdb_idl_txn_status
ovsdb_idl_txn_commit_block(struct ovsdb_idl_txn *txn)
{
    enum ovsdb_idl_txn_status status;

    fatal_signal_run();
    while ((status = ovsdb_idl_txn_commit(txn)) == TXN_INCOMPLETE) {
        *poll_timer_wait(1000);*
        ovsdb_idl_run(txn->idl);
        ovsdb_idl_wait(txn->idl);
        ovsdb_idl_txn_wait(txn);
        poll_block();
    }
    return status;
}


Also there is another problem, I don't know if these codes will work.

As there is a while loop, if ovsdb-server continue block and no answer
return, will the loop be dead-loop ?


2015-01-20 2:19 GMT+08:00 Ben Pfaff <blp at nicira.com>:

> On Mon, Jan 19, 2015 at 03:49:21PM +0800, yewgang wrote:
> > Now for some reason I have to write codes like this (My program perform
> > ovsdb-client):
> >
> > LOOP {
> >     ........
> >     important task every 2 second;
> >     ovsdb_idl_txn_commit_block(txn);
> >     ........
> > }
> >
> > If ovsdb-server is OK, ovsdb_idl_txn_commit_block will not block; but if
> > ovsdb-server is blocked or network is blocked, Is there any possible for
> my
> > program blocking at *poll_block()* (in ovsdb_idl_txn_commit_block
> function)
> > for long time ?
>
> If it takes a long time for a network response, then, yes, poll_block()
> could block for 2 seconds or more.
>
> If you need faster response than that then you probably shouldn't use
> ovsdb_idl_txn_commit_block().  Use ovsdb_idl_txn_commit() and
> poll_block() by hand, plus poll_timer_wait() or poll_timer_wait_until()
> to ensure that poll_block() wakes up by your deadline.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20150122/3c2911d2/attachment-0002.html>


More information about the discuss mailing list