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

Ben Pfaff blp at nicira.com
Thu Jan 22 04:49:46 UTC 2015


It's not what I recommended.  If you're not going to take my advice
anyway then I don't see much point in giving more of it.

On Thu, Jan 22, 2015 at 11:01:54AM +0800, yewgang wrote:
> 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.
> >

> _______________________________________________
> discuss mailing list
> discuss at openvswitch.org
> http://openvswitch.org/mailman/listinfo/discuss




More information about the discuss mailing list