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

Comparing IO-AIO/AIO.xs (file contents):
Revision 1.73 by root, Tue Oct 24 21:26:30 2006 UTC vs.
Revision 1.74 by root, Wed Oct 25 17:57:30 2006 UTC

128 128
129static int next_pri = DEFAULT_PRI + PRI_BIAS; 129static int next_pri = DEFAULT_PRI + PRI_BIAS;
130 130
131static int started, wanted; 131static int started, wanted;
132static volatile int nreqs; 132static volatile int nreqs;
133static int max_outstanding = 1<<30;
134static int respipe [2]; 133static int respipe [2];
135 134
136#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP) 135#if __linux && defined (PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP)
137# define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP 136# define AIO_MUTEX_INIT PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
138#else 137#else
238 } 237 }
239 238
240 abort (); 239 abort ();
241} 240}
242 241
242static int poll_cb ();
243static void req_invoke (aio_req req); 243static void req_invoke (aio_req req);
244static void req_free (aio_req req); 244static void req_free (aio_req req);
245static void req_cancel (aio_req req); 245static void req_cancel (aio_req req);
246 246
247/* must be called at most once */ 247/* must be called at most once */
600 600
601 LOCK (reqlock); 601 LOCK (reqlock);
602 reqq_push (&req_queue, req); 602 reqq_push (&req_queue, req);
603 pthread_cond_signal (&reqwait); 603 pthread_cond_signal (&reqwait);
604 UNLOCK (reqlock); 604 UNLOCK (reqlock);
605
606 if (nreqs > max_outstanding)
607 for (;;)
608 {
609 poll_cb ();
610
611 if (nreqs <= max_outstanding)
612 break;
613
614 poll_wait ();
615 }
616} 605}
617 606
618static void end_thread (void) 607static void end_thread (void)
619{ 608{
620 aio_req req; 609 aio_req req;
1116void 1105void
1117max_parallel (nthreads) 1106max_parallel (nthreads)
1118 int nthreads 1107 int nthreads
1119 PROTOTYPE: $ 1108 PROTOTYPE: $
1120 1109
1121int
1122max_outstanding (nreqs)
1123 int nreqs
1124 PROTOTYPE: $
1125 CODE:
1126 RETVAL = max_outstanding;
1127 max_outstanding = nreqs;
1128
1129void 1110void
1130aio_open (pathname,flags,mode,callback=&PL_sv_undef) 1111aio_open (pathname,flags,mode,callback=&PL_sv_undef)
1131 SV * pathname 1112 SV * pathname
1132 int flags 1113 int flags
1133 int mode 1114 int mode

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines