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.13 by root, Tue Aug 14 11:44:53 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
40#ifndef ETP_API_DECL 44#ifndef ETP_API_DECL
41# define ETP_API_DECL static 45# define ETP_API_DECL static
42#endif 46#endif
43 47
44#ifndef ETP_PRI_MIN 48#ifndef ETP_PRI_MIN
586 etp_maybe_start_thread (pool); 590 etp_maybe_start_thread (pool);
587 } 591 }
588} 592}
589 593
590ETP_API_DECL void ecb_cold 594ETP_API_DECL void ecb_cold
591etp_set_max_poll_time (etp_pool pool, double nseconds) 595etp_set_max_poll_time (etp_pool pool, double seconds)
592{ 596{
593 if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock); 597 if (WORDACCESS_UNSAFE) X_LOCK (pool->reslock);
594 pool->max_poll_time = nseconds * ETP_TICKS; 598 pool->max_poll_time = seconds * ETP_TICKS;
595 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); 599 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock);
596} 600}
597 601
598ETP_API_DECL void ecb_cold 602ETP_API_DECL void ecb_cold
599etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs) 603etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs)
602 pool->max_poll_reqs = maxreqs; 606 pool->max_poll_reqs = maxreqs;
603 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock); 607 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reslock);
604} 608}
605 609
606ETP_API_DECL void ecb_cold 610ETP_API_DECL void ecb_cold
607etp_set_max_idle (etp_pool pool, unsigned int nthreads) 611etp_set_max_idle (etp_pool pool, unsigned int threads)
608{ 612{
609 if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock); 613 if (WORDACCESS_UNSAFE) X_LOCK (pool->reqlock);
610 pool->max_idle = nthreads; 614 pool->max_idle = threads;
611 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); 615 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock);
612} 616}
613 617
614ETP_API_DECL void ecb_cold 618ETP_API_DECL void ecb_cold
615etp_set_idle_timeout (etp_pool pool, unsigned int seconds) 619etp_set_idle_timeout (etp_pool pool, unsigned int seconds)
618 pool->idle_timeout = seconds; 622 pool->idle_timeout = seconds;
619 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock); 623 if (WORDACCESS_UNSAFE) X_UNLOCK (pool->reqlock);
620} 624}
621 625
622ETP_API_DECL void ecb_cold 626ETP_API_DECL void ecb_cold
623etp_set_min_parallel (etp_pool pool, unsigned int nthreads) 627etp_set_min_parallel (etp_pool pool, unsigned int threads)
624{ 628{
625 if (pool->wanted < nthreads) 629 if (pool->wanted < threads)
626 pool->wanted = nthreads; 630 pool->wanted = threads;
627} 631}
628 632
629ETP_API_DECL void ecb_cold 633ETP_API_DECL void ecb_cold
630etp_set_max_parallel (etp_pool pool, unsigned int nthreads) 634etp_set_max_parallel (etp_pool pool, unsigned int threads)
631{ 635{
632 if (pool->wanted > nthreads) 636 if (pool->wanted > threads)
633 pool->wanted = nthreads; 637 pool->wanted = threads;
634 638
635 while (pool->started > pool->wanted) 639 while (pool->started > pool->wanted)
636 etp_end_thread (pool); 640 etp_end_thread (pool);
637} 641}
638 642

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines