using System;
using Chernobyl.DesignPatterns.Pool;
namespace Chernobyl.Threading.Workers
{
///
/// An interface for implementing and working with
/// worker classes.
///
public interface IWorker
{
///
/// Should have the worker begin working on the jobs
/// assigned to it.
///
void Start();
///
/// Should stop the worker from working and
/// allow his thread to end.
///
void Stop();
///
/// The pool that the worker will pull jobs off
/// of to work on. The worker is responsible for
/// pulling getting jobs from the pool, working on
/// those jobs, and then giving those jobs back.
///
IPool JobPool { get; set; }
///
/// True if this worker is working, i.e. was called
/// and hasn't been called yet.
///
bool IsWorking { get; }
///
/// Gets and sets the name of this worker.
///
string Name { get; set; }
///
/// When this worker starts his workday this event is invoked.
///
event EventHandler OnWorkStart;
///
/// When this worker ends his workday this event is invoked.
///
event EventHandler OnWorkEnd;
}
}