pike.git/
lib/
modules/
Sql.pmod/
pgsql_util.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-11-17
2014-11-17 11:35:53 by Stephen R. van den Berg <srb@cuci.nl>
3bf511b78e6dd360c0e8daf439236ddb2b59a57b (
7
lines) (+
7
/-
0
)
[
Show
|
Annotate
]
Branch:
8.1
pgsql: Eliminate race while flushing output buffer.
161:
final Stdio.File socket; private object pgsqlsess; private int towrite;
+
private Thread.Mutex towritemux;
final function(:void) gottimeout; final int timeout;
228:
} private int write_cb() {
+
Thread.MutexKey lock=towritemux->lock();
towrite-=output_to(socket,towrite);
-
+
lock=0;
if(!fillread && !sizeof(this)) { PD("%d>Close socket delayed\n",socket->query_fd()); socket->close();
289:
add(PGFLUSH); case SENDOUT:; }
+
Thread.MutexKey lock=towritemux->lock();
if(towrite=sizeof(this)) { PD("%d>Sendcmd %O\n",socket->query_fd(),((string)this)[..towrite-1]); towrite-=output_to(socket,towrite); }
-
+
lock=0;
} while(0); started=0; return;
381:
i::create(); o::create(); qportals = _qportals; synctransact = 1;
+
towritemux=Thread.Mutex();
fillread=Thread.Condition(); fillreadmux=Thread.Mutex(); gottimeout=sendcmd; // Preset it with a NOP