Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-21 Thread Raimon Fernandez
hi again, On 20dic, 2010, at 18:48 , Tom Lane wrote: >> So, now I'm using the PQisBusy to check if postgre is still busy and I can >> safely call the PQgetResult wihtout blocking, or just wait *some time* >> before sending a new PQisBusy. > > Your proposed code is still a busy-wait loop. What

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
On 21dic, 2010, at 00:56 , Alban Hertroys wrote: > On 20 Dec 2010, at 21:49, Raimon Fernandez wrote: > >> The select(2) that says that are using for wait is this line ? if >> (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) { >> >> I can't see where is 'sleeping' > > > See man 2 select.

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Alban Hertroys
On 20 Dec 2010, at 21:49, Raimon Fernandez wrote: > The select(2) that says that are using for wait is this line ? if > (select(sock + 1, &input_mask, NULL, NULL, NULL) < 0) { > > I can't see where is 'sleeping' See man 2 select. If you're on an OS without manual pages (Windows is pretty much

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
On 20dic, 2010, at 18:48 , Tom Lane wrote: >> So, now I'm using the PQisBusy to check if postgre is still busy and I can >> safely call the PQgetResult wihtout blocking, or just wait *some time* >> before sending a new PQisBusy. > > Your proposed code is still a busy-wait loop. This is how ar

Re: [GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Tom Lane
Raimon Fernandez writes: > Almost everything is working, and now I want to implememt the asynchronous > issue. > I send the SQL using the PQsendQuery, and my interface is not blocking, great. > Now, everytime I check fot the PQgetResult my interface gets blocked. Well, yes. PQgetResult says w

[GENERAL] libpq ASYNC with PQgetResult and PQisBusy

2010-12-20 Thread Raimon Fernandez
Hello, I'm trying to create a plugin using the libpq. Almost everything is working, and now I want to implememt the asynchronous issue. I send the SQL using the PQsendQuery, and my interface is not blocking, great. Now, everytime I check fot the PQgetResult my interface gets blocked. So, now