Re: libpq, blocking/nonblocking mechanism
От | Terry Lee Tucker |
---|---|
Тема | Re: libpq, blocking/nonblocking mechanism |
Дата | |
Msg-id | 200505310651.54505.terry@esc1.com обсуждение исходный текст |
Ответ на | libpq, blocking/nonblocking mechanism (Volkan YAZICI <volkan.yazici@gmail.com>) |
Ответы |
Re: libpq, blocking/nonblocking mechanism
|
Список | pgsql-interfaces |
From the docs: PQsetnonblocking Sets the nonblocking status of the connection. int PQsetnonblocking(PGconn *conn, int arg); Sets the state of the connection to nonblocking if arg is 1, or blocking if arg is 0. Returns 0 if OK, -1 if error. In the nonblocking state, calls to PQsendQuery, PQputline, PQputnbytes, and PQendcopy will not block but instead return an error if they need to be called again. Note that PQexec does not honor nonblocking mode; if it is called, it will act in blocking fashion anyway. A call to PQsetnonblocking only affects PQsendQuery, etc. These commands will work without calling PQsetnonblocking, but they will block. Our application uses a combination of PQexec and PQsendQuery. I'm looking at the documentation in: file:/usr/share/doc/postgresql-7.4.6/html/libpq-async.html on my machine. On Saturday 28 May 2005 04:34 pm, Volkan YAZICI saith: > Hi, > > While I'm trying to figure out the point of PQsetnonblocking() call, > confused so much on blocking/nonblocking mechanism. > > Sync. Connect » Async. Query > Async. Connect » Sync. Query > > Both of above flows work without any PQsetnonblocking() call. > Therefore sync/async connection and sync/async query execution are not > dependent to each other. (Right?) If so, what's the point of > PQsetnonblocking() function? When do we require it and when should we > use it? > > As I saw from src/interfaces/libpq/fe-exec.c, PQsetnonblocking() only > assigns True or False to conn->nonblocking variable. When I searched > for "->nonblocking" under libpq directory, I found that it's used > while creating an empty PGconn and while closing PGconn. This didn't > help me too. > > I'd be so appreciated for a comprehensive "specialized for dummies" answer. > Regards. > > P.S. Documentation pointers will be accepted with pleasure too. > > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > > http://www.postgresql.org/docs/faq
В списке pgsql-interfaces по дате отправления: