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

Comparing libeio/etp.c (file contents):
Revision 1.9 by root, Thu Jun 25 20:41:03 2015 UTC vs.
Revision 1.14 by root, Tue Aug 14 11:47:01 2018 UTC

35 * and other provisions required by the GPL. If you do not delete the 35 * and other provisions required by the GPL. If you do not delete the
36 * provisions above, a recipient may use your version of this file under 36 * provisions above, a recipient may use your version of this file under
37 * either the BSD or the GPL. 37 * either the BSD or the GPL.
38 */ 38 */
39 39
40#if HAVE_SYS_PRCTL_H
41# include <sys/prctl.h>
42#endif
43
44#ifdef EIO_STACKSIZE
45# define X_STACKSIZE EIO_STACKSIZE
46#endif
47#include "xthread.h"
48
40#ifndef ETP_API_DECL 49#ifndef ETP_API_DECL
41# define ETP_API_DECL static 50# define ETP_API_DECL static
42#endif 51#endif
43 52
44#ifndef ETP_PRI_MIN 53#ifndef ETP_PRI_MIN
586 etp_maybe_start_thread (pool); 595 etp_maybe_start_thread (pool);
587 } 596 }
588} 597}
589 598
590ETP_API_DECL void ecb_cold 599ETP_API_DECL void ecb_cold
591etp_set_max_poll_time (etp_pool pool, double nseconds) 600etp_set_max_poll_time (etp_pool pool, double seconds)
592{ 601{
593 if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock); 602 if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock);
594 pool->max_poll_time = nseconds * ETP_TICKS; 603 pool->max_poll_time = seconds * ETP_TICKS;
595 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); 604 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock);
596} 605}
597 606
598ETP_API_DECL void ecb_cold 607ETP_API_DECL void ecb_cold
599etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs) 608etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs)
602 pool->max_poll_reqs = maxreqs; 611 pool->max_poll_reqs = maxreqs;
603 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); 612 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock);
604} 613}
605 614
606ETP_API_DECL void ecb_cold 615ETP_API_DECL void ecb_cold
607etp_set_max_idle (etp_pool pool, unsigned int nthreads) 616etp_set_max_idle (etp_pool pool, unsigned int threads)
608{ 617{
609 if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); 618 if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock);
610 pool->max_idle = nthreads; 619 pool->max_idle = threads;
611 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); 620 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock);
612} 621}
613 622
614ETP_API_DECL void ecb_cold 623ETP_API_DECL void ecb_cold
615etp_set_idle_timeout (etp_pool pool, unsigned int seconds) 624etp_set_idle_timeout (etp_pool pool, unsigned int seconds)
618 pool->idle_timeout = seconds; 627 pool->idle_timeout = seconds;
619 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); 628 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock);
620} 629}
621 630
622ETP_API_DECL void ecb_cold 631ETP_API_DECL void ecb_cold
623etp_set_min_parallel (etp_pool pool, unsigned int nthreads) 632etp_set_min_parallel (etp_pool pool, unsigned int threads)
624{ 633{
625 if (pool->wanted < nthreads) 634 if (pool->wanted < threads)
626 pool->wanted = nthreads; 635 pool->wanted = threads;
627} 636}
628 637
629ETP_API_DECL void ecb_cold 638ETP_API_DECL void ecb_cold
630etp_set_max_parallel (etp_pool pool, unsigned int nthreads) 639etp_set_max_parallel (etp_pool pool, unsigned int threads)
631{ 640{
632 if (pool->wanted > nthreads) 641 if (pool->wanted > threads)
633 pool->wanted = nthreads; 642 pool->wanted = threads;
634 643
635 while (pool->started > pool->wanted) 644 while (pool->started > pool->wanted)
636 etp_end_thread (pool); 645 etp_end_thread (pool);
637} 646}
638 647

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines