… | |
… | |
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 | |
590 | ETP_API_DECL void ecb_cold |
594 | ETP_API_DECL void ecb_cold |
591 | etp_set_max_poll_time (etp_pool pool, double nseconds) |
595 | etp_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 | |
598 | ETP_API_DECL void ecb_cold |
602 | ETP_API_DECL void ecb_cold |
599 | etp_set_max_poll_reqs (etp_pool pool, unsigned int maxreqs) |
603 | etp_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 | |
606 | ETP_API_DECL void ecb_cold |
610 | ETP_API_DECL void ecb_cold |
607 | etp_set_max_idle (etp_pool pool, unsigned int nthreads) |
611 | etp_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 | |
614 | ETP_API_DECL void ecb_cold |
618 | ETP_API_DECL void ecb_cold |
615 | etp_set_idle_timeout (etp_pool pool, unsigned int seconds) |
619 | etp_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 | |
622 | ETP_API_DECL void ecb_cold |
626 | ETP_API_DECL void ecb_cold |
623 | etp_set_min_parallel (etp_pool pool, unsigned int nthreads) |
627 | etp_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 | |
629 | ETP_API_DECL void ecb_cold |
633 | ETP_API_DECL void ecb_cold |
630 | etp_set_max_parallel (etp_pool pool, unsigned int nthreads) |
634 | etp_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 | |