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

Comparing BDB/BDB.xs (file contents):
Revision 1.33 by root, Sun Mar 30 04:57:55 2008 UTC vs.
Revision 1.34 by root, Sun Mar 30 06:28:08 2008 UTC

60# define c_dup dup 60# define c_dup dup
61# define c_get get 61# define c_get get
62# define c_pget pget 62# define c_pget pget
63# define c_put put 63# define c_put put
64#endif 64#endif
65
66static char *
67get_bdb_filename (SV *sv)
68{
69 return !SvOK (sv)
70 ? 0
71 :
72#if WIN32
73 SvPVutf8_nolen (sv)
74#else
75 SvPVbyte_nolen (sv)
76#endif
77 ;
78}
65 79
66static void 80static void
67debug_errcall (const DB_ENV *dbenv, const char *errpfx, const char *msg) 81debug_errcall (const DB_ENV *dbenv, const char *errpfx, const char *msg)
68{ 82{
69 printf ("err[%s]\n", msg); 83 printf ("err[%s]\n", msg);
205static mutex_t reqlock = X_MUTEX_INIT; 219static mutex_t reqlock = X_MUTEX_INIT;
206static cond_t reqwait = X_COND_INIT; 220static cond_t reqwait = X_COND_INIT;
207 221
208#if WORDACCESS_UNSAFE 222#if WORDACCESS_UNSAFE
209 223
210static unsigned int get_nready () 224static unsigned int get_nready (void)
211{ 225{
212 unsigned int retval; 226 unsigned int retval;
213 227
214 X_LOCK (reqlock); 228 X_LOCK (reqlock);
215 retval = nready; 229 retval = nready;
216 X_UNLOCK (reqlock); 230 X_UNLOCK (reqlock);
217 231
218 return retval; 232 return retval;
219} 233}
220 234
221static unsigned int get_npending () 235static unsigned int get_npending (void)
222{ 236{
223 unsigned int retval; 237 unsigned int retval;
224 238
225 X_LOCK (reslock); 239 X_LOCK (reslock);
226 retval = npending; 240 retval = npending;
227 X_UNLOCK (reslock); 241 X_UNLOCK (reslock);
228 242
229 return retval; 243 return retval;
230} 244}
231 245
232static unsigned int get_nthreads () 246static unsigned int get_nthreads (void)
233{ 247{
234 unsigned int retval; 248 unsigned int retval;
235 249
236 X_LOCK (wrklock); 250 X_LOCK (wrklock);
237 retval = started; 251 retval = started;
300 } 314 }
301 315
302 abort (); 316 abort ();
303} 317}
304 318
305static int poll_cb (); 319static int poll_cb (void);
306static void req_free (bdb_req req); 320static void req_free (bdb_req req);
307static void req_cancel (bdb_req req); 321static void req_cancel (bdb_req req);
308 322
309static int req_invoke (bdb_req req) 323static int req_invoke (bdb_req req)
310{ 324{
391#else 405#else
392# define TO_SOCKET(x) (x) 406# define TO_SOCKET(x) (x)
393#endif 407#endif
394 408
395static void 409static void
396create_respipe () 410create_respipe (void)
397{ 411{
398#ifdef _WIN32 412#ifdef _WIN32
399 int arg; /* argg */ 413 int arg; /* argg */
400#endif 414#endif
401 int old_readfd = respipe [0]; 415 int old_readfd = respipe [0];
455 free (wrk); 469 free (wrk);
456 470
457 X_UNLOCK (wrklock); 471 X_UNLOCK (wrklock);
458} 472}
459 473
460static void maybe_start_thread () 474static void maybe_start_thread (void)
461{ 475{
462 if (get_nthreads () >= wanted) 476 if (get_nthreads () >= wanted)
463 return; 477 return;
464 478
465 /* todo: maybe use idle here, but might be less exact */ 479 /* todo: maybe use idle here, but might be less exact */
550 564
551 while (started > wanted) 565 while (started > wanted)
552 end_thread (); 566 end_thread ();
553} 567}
554 568
555static void poll_wait () 569static void poll_wait (void)
556{ 570{
557 fd_set rfd; 571 fd_set rfd;
558 572
559 while (nreqs) 573 while (nreqs)
560 { 574 {
573 587
574 PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0); 588 PerlSock_select (respipe [0] + 1, &rfd, 0, 0, 0);
575 } 589 }
576} 590}
577 591
578static int poll_cb () 592static int poll_cb (void)
579{ 593{
580 dSP; 594 dSP;
581 int count = 0; 595 int count = 0;
582 int maxreqs = max_poll_reqs; 596 int maxreqs = max_poll_reqs;
583 int do_croak = 0; 597 int do_croak = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines