NAME

Padre::SlaveDriver - Padre thread spawning

SYNOPSIS

use Padre::SlaveDriver;
my $sd = Padre::SlaveDriver->new();
my $slave_thread = $sd->spawn($taskManager);

DESCRIPTION

Padre uses threads for asynchronous background operations which may take so long that they would make the GUI unresponsive if run in the main (GUI) thread.

This class is a helper that will spawn new worker on demand. It keeps a single model thread around that was (or should have been) created very early in the start-up process of Padre. Therefore, the threads' memory consumption will be significantly lower than if one created new worker (slave) threads from the main Padre thread.

Maintainer note: This module must not load any other part of Padre and should generally be kept low on memory overhead.

INTERFACE

Class Methods

new

The constructor returns a Padre::SlaveDriver object. Padre::SlaveDriver is a singleton.

An object is instantiated when the editor object is created.

Object methods

spawn

Takes the Padre::TaskManager object as argument. Returns a new worker thread object.

task_queue

Returns the task queue (Thread::Queue object) for use by the Padre::TaskManager for passing processing tasks to the worker threads.

This queue is instantiated by the slave driver because it needs to be available early for passing to the master thread.

cleanup

Reaps the master thread. Will be called by the TaskManager on shutdown and on global destruction.

TO DO

What if the computer can't keep up with the queued jobs? This needs some consideration and probably, the schedule() call needs to block once the queue is "full". However, it's not clear how this can work if the Wx MainLoop isn't reached for processing finish events.

Polling services aliveness in a useful way, something a Wx::Taskmanager might like to display. Ability to selectively kill tasks/services

SEE ALSO

The base class of all "work units" is Padre::Task.

AUTHOR

Steffen Mueller smueller@cpan.org

COPYRIGHT AND LICENSE

Copyright 2008-2010 The Padre development team as listed in Padre.pm.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5 itself.