[][src]Struct pleco_engine::threadpool::ThreadPool

pub struct ThreadPool {
    pub threads: Vec<UnsafeCell<*mut Searcher>>,
    pub main_cond: Arc<LockLatch>,
    pub thread_cond: Arc<LockLatch>,
    pub stop: AtomicBool,
    // some fields omitted
}

The thread-pool for the chess engine.

Fields

threads: Vec<UnsafeCell<*mut Searcher>>

Access to each thread's Structure

main_cond: Arc<LockLatch>

Condition for the main thread to start.

thread_cond: Arc<LockLatch>

Condition for all non-main threads

stop: AtomicBool

Stop condition, if true the threads should halt.

Methods

impl ThreadPool[src]

pub fn new() -> Self[src]

Creates a new ThreadPool

pub fn size(&self) -> usize[src]

Returns the number of threads

pub fn stdout(&mut self, use_stdout: bool)[src]

Sets the use of standard out. This can be changed mid search as well.

pub fn set_thread_count(&mut self, num: usize)[src]

Sets the thread count of the pool. If num is less than 1, nothing will happen.

Safety

Completely unsafe to use when the pool is searching.

pub fn kill_all(&mut self)[src]

Kills and de-allocates all the threads that are running. This function will also block on waiting for the search to finish.

pub fn set_stop(&mut self, stop: bool)[src]

Sets the threads to stop (or not!).

pub fn wait_for_finish(&self)[src]

Waits for all the threads to finish

pub fn wait_for_start(&self)[src]

Waits for all the threads to start.

pub fn wait_for_non_main(&self)[src]

Waits for all non-main threads to finish.

pub fn wait_for_main_start(&self)[src]

Waits for all the non-main threads to start running

pub fn clear_all(&mut self)[src]

Starts a UCI search. The result will be printed to stdout if the stdout setting is true.

pub fn search(&mut self, board: &Board, limits: &Limits) -> BitMove[src]

Performs a standard search, and blocks waiting for a returned BitMove.

pub fn best_move(&mut self) -> BitMove[src]

Returns the best move of a search

pub fn nodes(&self) -> u64[src]

Returns total number of nodes searched so far.

Trait Implementations

impl Drop for ThreadPool[src]

Auto Trait Implementations

impl !Send for ThreadPool

impl !Sync for ThreadPool

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]