pike.git/
lib/
modules/
Sql.pmod/
pgsql_util.pmod
Branch:
Tag:
Non-build tags
All tags
No tags
2014-11-10
2014-11-10 22:47:13 by Stephen R. van den Berg <srb@cuci.nl>
16b883f85d24c583c8152a8fb1e4ff390c53b185 (
16
lines) (+
14
/-
2
)
[
Show
|
Annotate
]
Branch:
8.1
Add documentation about the custom backend.
4:
*/ //! The pgsql backend, shared between all connection instances.
-
//! It
even
runs in non-callback mode.
+
//! It
runs
even in non-callback mode
in a separate thread
.
+
//!
+
//! @note
+
//! Callbacks running from this backend directly determine the latency
+
//! in reacting to communication with the database server; so it
+
//! would be prudent not to block in these callbacks.
#pike __REAL_VERSION__ #require constant(Thread.Thread) #include "pgsql.h"
-
protected
Thread.Mutex
backendmux
=
Thread
.
Mutex();
+
//!
The
instance
of
the pgsql dedicated backend
.
final Pike.Backend local_backend = Pike.SmallBackend();
-
+
+
protected Thread.Mutex backendmux = Thread.Mutex();
protected int clientsregistered; multiset cachealways=(<"BEGIN","begin","END","end","COMMIT","commit">);
48:
} while(looponce); }
+
//! Registers yourself as a user of this backend. If the backend
+
//! has not been started yet, it will be spawned automatically.
final void register_backend() { if(!clientsregistered++) Thread.Thread(run_local_backend); }
-
+
//! Unregisters yourself as a user of this backend. If there are
+
//! no longer any registered users, the backend will be terminated.
final void unregister_backend() { --clientsregistered; }