ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/BDB/BDB.xs
(Generate patch)

Comparing BDB/BDB.xs (file contents):
Revision 1.71 by root, Thu Nov 12 00:39:58 2009 UTC vs.
Revision 1.74 by root, Wed Mar 31 00:44:51 2010 UTC

224static int next_pri = DEFAULT_PRI + PRI_BIAS; 224static int next_pri = DEFAULT_PRI + PRI_BIAS;
225 225
226static unsigned int started, idle, wanted; 226static unsigned int started, idle, wanted;
227 227
228/* worker threads management */ 228/* worker threads management */
229static mutex_t wrklock = X_MUTEX_INIT; 229static xmutex_t wrklock = X_MUTEX_INIT;
230 230
231typedef struct worker { 231typedef struct worker {
232 /* locked by wrklock */ 232 /* locked by wrklock */
233 struct worker *prev, *next; 233 struct worker *prev, *next;
234 234
235 thread_t tid; 235 xthread_t tid;
236 236
237 /* locked by reslock, reqlock or wrklock */ 237 /* locked by reslock, reqlock or wrklock */
238 bdb_req req; /* currently processed request */ 238 bdb_req req; /* currently processed request */
239 void *dbuf; 239 void *dbuf;
240 DIR *dirp; 240 DIR *dirp;
257static volatile unsigned int nreqs, nready, npending; 257static volatile unsigned int nreqs, nready, npending;
258static volatile unsigned int max_idle = 4; 258static volatile unsigned int max_idle = 4;
259static volatile unsigned int max_outstanding = 0xffffffff; 259static volatile unsigned int max_outstanding = 0xffffffff;
260static s_epipe respipe; 260static s_epipe respipe;
261 261
262static mutex_t reslock = X_MUTEX_INIT; 262static xmutex_t reslock = X_MUTEX_INIT;
263static mutex_t reqlock = X_MUTEX_INIT; 263static xmutex_t reqlock = X_MUTEX_INIT;
264static cond_t reqwait = X_COND_INIT; 264static xcond_t reqwait = X_COND_INIT;
265 265
266#if WORDACCESS_UNSAFE 266#if WORDACCESS_UNSAFE
267 267
268static unsigned int get_nready (void) 268static unsigned int get_nready (void)
269{ 269{
1188 1188
1189PROTOTYPES: ENABLE 1189PROTOTYPES: ENABLE
1190 1190
1191BOOT: 1191BOOT:
1192{ 1192{
1193 bdb_stash = gv_stashpv ("BDB" , 1);
1194 bdb_env_stash = gv_stashpv ("BDB::Env" , 1);
1195 bdb_txn_stash = gv_stashpv ("BDB::Txn" , 1);
1196 bdb_cursor_stash = gv_stashpv ("BDB::Cursor" , 1);
1197 bdb_db_stash = gv_stashpv ("BDB::Db" , 1);
1198 bdb_sequence_stash = gv_stashpv ("BDB::Sequence", 1);
1199
1200 static const struct { 1193 static const struct {
1201 const char *name; 1194 const char *name;
1202 IV iv; 1195 IV iv;
1203 } *civ, const_iv[] = { 1196 } *civ, const_iv[] = {
1204#define const_iv(name) { # name, (IV)DB_ ## name }, 1197#define const_iv(name) { # name, (IV)DB_ ## name },
1233 const_iv (TXN_NOT_DURABLE) 1226 const_iv (TXN_NOT_DURABLE)
1234 const_iv (TXN_WRITE_NOSYNC) 1227 const_iv (TXN_WRITE_NOSYNC)
1235 const_iv (WRITECURSOR) 1228 const_iv (WRITECURSOR)
1236 const_iv (YIELDCPU) 1229 const_iv (YIELDCPU)
1237 const_iv (ENCRYPT_AES) 1230 const_iv (ENCRYPT_AES)
1231#if DB_VERSION_MINOR < 8
1238 const_iv (XA_CREATE) 1232 const_iv (XA_CREATE)
1233#endif
1239 const_iv (BTREE) 1234 const_iv (BTREE)
1240 const_iv (HASH) 1235 const_iv (HASH)
1241 const_iv (QUEUE) 1236 const_iv (QUEUE)
1242 const_iv (RECNO) 1237 const_iv (RECNO)
1243 const_iv (UNKNOWN) 1238 const_iv (UNKNOWN)
1307 const_iv (LOCK_OLDEST) 1302 const_iv (LOCK_OLDEST)
1308 const_iv (LOCK_RANDOM) 1303 const_iv (LOCK_RANDOM)
1309 const_iv (LOCK_YOUNGEST) 1304 const_iv (LOCK_YOUNGEST)
1310 1305
1311 const_iv (DONOTINDEX) 1306 const_iv (DONOTINDEX)
1312 const_iv (KEYEMPTY ) 1307 const_iv (KEYEMPTY)
1313 const_iv (KEYEXIST ) 1308 const_iv (KEYEXIST)
1314 const_iv (LOCK_DEADLOCK) 1309 const_iv (LOCK_DEADLOCK)
1315 const_iv (LOCK_NOTGRANTED) 1310 const_iv (LOCK_NOTGRANTED)
1316 const_iv (NOSERVER) 1311 const_iv (NOSERVER)
1317 const_iv (NOSERVER_HOME) 1312 const_iv (NOSERVER_HOME)
1318 const_iv (NOSERVER_ID) 1313 const_iv (NOSERVER_ID)
1347 const_iv (VERB_WAITSFOR) 1342 const_iv (VERB_WAITSFOR)
1348 1343
1349 const_iv (VERSION_MAJOR) 1344 const_iv (VERSION_MAJOR)
1350 const_iv (VERSION_MINOR) 1345 const_iv (VERSION_MINOR)
1351 const_iv (VERSION_PATCH) 1346 const_iv (VERSION_PATCH)
1347 const_iv (LOGVERSION)
1348 const_iv (LOGOLDVER)
1352#if DB_VERSION_MINOR >= 3 1349#if DB_VERSION_MINOR >= 3
1353 const_iv (INORDER) 1350 const_iv (INORDER)
1354 const_iv (LOCK_MAXWRITE) 1351 const_iv (LOCK_MAXWRITE)
1355 const_iv (SEQ_DEC) 1352 const_iv (SEQ_DEC)
1356 const_iv (SEQ_INC) 1353 const_iv (SEQ_INC)
1397 const_iv (LOG_AUTOREMOVE) 1394 const_iv (LOG_AUTOREMOVE)
1398# if DB_VERSION_MINOR >= 3 1395# if DB_VERSION_MINOR >= 3
1399 const_iv (DSYNC_LOG) 1396 const_iv (DSYNC_LOG)
1400 const_iv (LOG_INMEMORY) 1397 const_iv (LOG_INMEMORY)
1401# endif 1398# endif
1399#if DB_VERSION_MINOR >= 8
1400 const_iv (LOGVERSION_LATCHING)
1401#endif
1402#endif 1402#endif
1403 }; 1403 };
1404
1405 bdb_stash = gv_stashpv ("BDB" , 1);
1406 bdb_env_stash = gv_stashpv ("BDB::Env" , 1);
1407 bdb_txn_stash = gv_stashpv ("BDB::Txn" , 1);
1408 bdb_cursor_stash = gv_stashpv ("BDB::Cursor" , 1);
1409 bdb_db_stash = gv_stashpv ("BDB::Db" , 1);
1410 bdb_sequence_stash = gv_stashpv ("BDB::Sequence", 1);
1404 1411
1405 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; ) 1412 for (civ = const_iv + sizeof (const_iv) / sizeof (const_iv [0]); civ-- > const_iv; )
1406 newCONSTSUB (bdb_stash, (char *)civ->name, newSViv (civ->iv)); 1413 newCONSTSUB (bdb_stash, (char *)civ->name, newSViv (civ->iv));
1407 1414
1408 prepare_cb = &PL_sv_undef; 1415 prepare_cb = &PL_sv_undef;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines