ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/libeio/eio.c
(Generate patch)

Comparing cvsroot/libeio/eio.c (file contents):
Revision 1.19 by root, Tue Jun 17 23:34:20 2008 UTC vs.
Revision 1.22 by root, Fri Jul 11 10:54:50 2008 UTC

177static mutex_t wrklock = X_MUTEX_INIT; 177static mutex_t wrklock = X_MUTEX_INIT;
178static mutex_t reslock = X_MUTEX_INIT; 178static mutex_t reslock = X_MUTEX_INIT;
179static mutex_t reqlock = X_MUTEX_INIT; 179static mutex_t reqlock = X_MUTEX_INIT;
180static cond_t reqwait = X_COND_INIT; 180static cond_t reqwait = X_COND_INIT;
181 181
182#if !HAVE_PREADWRITE
183/*
184 * make our pread/pwrite emulation safe against themselves, but not against
185 * normal read/write by using a mutex. slows down execution a lot,
186 * but that's your problem, not mine.
187 */
188static mutex_t preadwritelock = X_MUTEX_INIT;
189#endif
190
182typedef struct etp_worker 191typedef struct etp_worker
183{ 192{
184 /* locked by wrklock */ 193 /* locked by wrklock */
185 struct etp_worker *prev, *next; 194 struct etp_worker *prev, *next;
186 195
330 339
331static void etp_atfork_child (void) 340static void etp_atfork_child (void)
332{ 341{
333 ETP_REQ *prv; 342 ETP_REQ *prv;
334 343
335 while (prv = reqq_shift (&req_queue)) 344 while ((prv = reqq_shift (&req_queue)))
336 ETP_DESTROY (prv); 345 ETP_DESTROY (prv);
337 346
338 while (prv = reqq_shift (&res_queue)) 347 while ((prv = reqq_shift (&res_queue)))
339 ETP_DESTROY (prv); 348 ETP_DESTROY (prv);
340 349
341 while (wrk_first.next != &wrk_first) 350 while (wrk_first.next != &wrk_first)
342 { 351 {
343 etp_worker *wrk = wrk_first.next; 352 etp_worker *wrk = wrk_first.next;
700 709
701#if !HAVE_PREADWRITE 710#if !HAVE_PREADWRITE
702# define pread eio__pread 711# define pread eio__pread
703# define pwrite eio__pwrite 712# define pwrite eio__pwrite
704 713
705/*
706 * make our pread/pwrite safe against themselves, but not against
707 * normal read/write by using a mutex. slows down execution a lot,
708 * but that's your problem, not mine.
709 */
710static mutex_t preadwritelock = X_MUTEX_INIT;
711
712static ssize_t 714static ssize_t
713eio__pread (int fd, void *buf, size_t count, off_t offset) 715eio__pread (int fd, void *buf, size_t count, off_t offset)
714{ 716{
715 ssize_t res; 717 ssize_t res;
716 off_t ooffset; 718 off_t ooffset;
903 int memlen = 4096; 905 int memlen = 4096;
904 int memofs = 0; 906 int memofs = 0;
905 int res = 0; 907 int res = 0;
906 908
907 X_LOCK (wrklock); 909 X_LOCK (wrklock);
910 /* the corresponding closedir is in ETP_WORKER_CLEAR */
908 self->dirp = dirp = opendir (req->ptr1); 911 self->dirp = dirp = opendir (req->ptr1);
909 req->flags |= EIO_FLAG_PTR2_FREE; 912 req->flags |= EIO_FLAG_PTR2_FREE;
910 req->ptr2 = names = malloc (memlen); 913 req->ptr2 = names = malloc (memlen);
911 X_UNLOCK (wrklock); 914 X_UNLOCK (wrklock);
912 915

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines