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

Comparing libeio/eio.c (file contents):
Revision 1.136 by root, Thu Jun 25 17:05:07 2015 UTC vs.
Revision 1.139 by root, Thu Jun 25 18:14:19 2015 UTC

366#define ETP_PRI_MAX EIO_PRI_MAX 366#define ETP_PRI_MAX EIO_PRI_MAX
367 367
368#define ETP_TYPE_QUIT -1 368#define ETP_TYPE_QUIT -1
369#define ETP_TYPE_GROUP EIO_GROUP 369#define ETP_TYPE_GROUP EIO_GROUP
370 370
371static void eio_nop_callback (void) { }
372static void (*eio_want_poll_cb)(void) = eio_nop_callback;
373static void (*eio_done_poll_cb)(void) = eio_nop_callback;
374
375#define ETP_WANT_POLL(pool) eio_want_poll_cb ()
376#define ETP_DONE_POLL(pool) eio_done_poll_cb ()
377
371struct etp_worker; 378struct etp_worker;
372
373#define ETP_REQ eio_req 379#define ETP_REQ eio_req
374#define ETP_DESTROY(req) eio_destroy (req) 380#define ETP_DESTROY(req) eio_destroy (req)
375static int eio_finish (eio_req *req); 381static int eio_finish (eio_req *req);
376#define ETP_FINISH(req) eio_finish (req) 382#define ETP_FINISH(req) eio_finish (req)
377static void eio_execute (struct etp_worker *self, eio_req *req); 383static void eio_execute (struct etp_worker *self, eio_req *req);
378#define ETP_EXECUTE(wrk,req) eio_execute (wrk, req) 384#define ETP_EXECUTE(wrk,req) eio_execute (wrk, req)
379 385
380#include "etp.c" 386#include "etp.c"
387
388static struct etp_pool eio_pool;
389#define EIO_POOL (&eio_pool)
381 390
382/*****************************************************************************/ 391/*****************************************************************************/
383 392
384static void 393static void
385grp_try_feed (eio_req *grp) 394grp_try_feed (eio_req *grp)
452} 461}
453 462
454void 463void
455eio_grp_cancel (eio_req *grp) 464eio_grp_cancel (eio_req *grp)
456{ 465{
457 etp_grp_cancel (grp); 466 etp_grp_cancel (EIO_POOL, grp);
458} 467}
459 468
460void 469void
461eio_cancel (eio_req *req) 470eio_cancel (eio_req *req)
462{ 471{
463 etp_cancel (req); 472 etp_cancel (EIO_POOL, req);
464} 473}
465 474
466void 475void
467eio_submit (eio_req *req) 476eio_submit (eio_req *req)
468{ 477{
469 etp_submit (req); 478 etp_submit (EIO_POOL, req);
470} 479}
471 480
472unsigned int 481unsigned int
473eio_nreqs (void) 482eio_nreqs (void)
474{ 483{
475 return etp_nreqs (); 484 return etp_nreqs (EIO_POOL);
476} 485}
477 486
478unsigned int 487unsigned int
479eio_nready (void) 488eio_nready (void)
480{ 489{
481 return etp_nready (); 490 return etp_nready (EIO_POOL);
482} 491}
483 492
484unsigned int 493unsigned int
485eio_npending (void) 494eio_npending (void)
486{ 495{
487 return etp_npending (); 496 return etp_npending (EIO_POOL);
488} 497}
489 498
490unsigned int ecb_cold 499unsigned int ecb_cold
491eio_nthreads (void) 500eio_nthreads (void)
492{ 501{
493 return etp_nthreads (); 502 return etp_nthreads (EIO_POOL);
494} 503}
495 504
496void ecb_cold 505void ecb_cold
497eio_set_max_poll_time (double nseconds) 506eio_set_max_poll_time (double nseconds)
498{ 507{
499 etp_set_max_poll_time (nseconds); 508 etp_set_max_poll_time (EIO_POOL, nseconds);
500} 509}
501 510
502void ecb_cold 511void ecb_cold
503eio_set_max_poll_reqs (unsigned int maxreqs) 512eio_set_max_poll_reqs (unsigned int maxreqs)
504{ 513{
505 etp_set_max_poll_reqs (maxreqs); 514 etp_set_max_poll_reqs (EIO_POOL, maxreqs);
506} 515}
507 516
508void ecb_cold 517void ecb_cold
509eio_set_max_idle (unsigned int nthreads) 518eio_set_max_idle (unsigned int nthreads)
510{ 519{
511 etp_set_max_idle (nthreads); 520 etp_set_max_idle (EIO_POOL, nthreads);
512} 521}
513 522
514void ecb_cold 523void ecb_cold
515eio_set_idle_timeout (unsigned int seconds) 524eio_set_idle_timeout (unsigned int seconds)
516{ 525{
517 etp_set_idle_timeout (seconds); 526 etp_set_idle_timeout (EIO_POOL, seconds);
518} 527}
519 528
520void ecb_cold 529void ecb_cold
521eio_set_min_parallel (unsigned int nthreads) 530eio_set_min_parallel (unsigned int nthreads)
522{ 531{
523 etp_set_min_parallel (nthreads); 532 etp_set_min_parallel (EIO_POOL, nthreads);
524} 533}
525 534
526void ecb_cold 535void ecb_cold
527eio_set_max_parallel (unsigned int nthreads) 536eio_set_max_parallel (unsigned int nthreads)
528{ 537{
529 etp_set_max_parallel (nthreads); 538 etp_set_max_parallel (EIO_POOL, nthreads);
530} 539}
531 540
532int eio_poll (void) 541int eio_poll (void)
533{ 542{
534 return etp_poll (); 543 return etp_poll (EIO_POOL);
535} 544}
536 545
537/*****************************************************************************/ 546/*****************************************************************************/
538/* work around various missing functions */ 547/* work around various missing functions */
539 548
1703/*****************************************************************************/ 1712/*****************************************************************************/
1704 1713
1705#define ALLOC(len) \ 1714#define ALLOC(len) \
1706 if (!req->ptr2) \ 1715 if (!req->ptr2) \
1707 { \ 1716 { \
1708 X_LOCK (wrklock); \ 1717 X_LOCK (EIO_POOL->wrklock); \
1709 req->flags |= EIO_FLAG_PTR2_FREE; \ 1718 req->flags |= EIO_FLAG_PTR2_FREE; \
1710 X_UNLOCK (wrklock); \ 1719 X_UNLOCK (EIO_POOL->wrklock); \
1711 req->ptr2 = malloc (len); \ 1720 req->ptr2 = malloc (len); \
1712 if (!req->ptr2) \ 1721 if (!req->ptr2) \
1713 { \ 1722 { \
1714 errno = ENOMEM; \ 1723 errno = ENOMEM; \
1715 req->result = -1; \ 1724 req->result = -1; \
1720/*****************************************************************************/ 1729/*****************************************************************************/
1721 1730
1722int ecb_cold 1731int ecb_cold
1723eio_init (void (*want_poll)(void), void (*done_poll)(void)) 1732eio_init (void (*want_poll)(void), void (*done_poll)(void))
1724{ 1733{
1725 return etp_init (want_poll, done_poll); 1734 eio_want_poll_cb = want_poll;
1735 eio_done_poll_cb = done_poll;
1736
1737 return etp_init (EIO_POOL, 0, 0, 0);
1726} 1738}
1727 1739
1728ecb_inline void 1740ecb_inline void
1729eio_api_destroy (eio_req *req) 1741eio_api_destroy (eio_req *req)
1730{ 1742{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines