Package ghidra.util.worker
Class Worker
Executes a single job at a time in FIFO order.
- See Also:
-
Constructor Summary
ConstructorDescriptionCreates a Worker that will use a shared thread pool to process jobs.Worker
(String name, boolean isPersistentThread, boolean useSharedThreadPool, TaskMonitor monitor) This constructor allows you to change persistence and shared thread pool usage.Worker
(String name, TaskMonitor monitor) Creates a Worker that will use a shared thread pool to process jobs. -
Method Summary
Modifier and TypeMethodDescriptionstatic Worker
A convenience method to create a Worker that uses a shared thread pool for performing operations for GUI clients in a background threadMethods inherited from class ghidra.util.worker.AbstractWorker
clearAllJobs, clearAllJobsWithInterrupt_IKnowTheRisks, clearPendingJobs, dispose, isBusy, isDisposed, schedule, setBusyListener, setTaskMonitor, waitUntilNoJobsScheduled
-
Constructor Details
-
Worker
Creates a Worker that will use a shared thread pool to process jobs. Also, threads created using this constructor are not persistent. Use this constructor when you do not have aTaskMonitor
that wants updates from this worker.- Parameters:
name
- the name of the shared thread pool.
-
Worker
Creates a Worker that will use a shared thread pool to process jobs. Also, threads created using this constructor are not persistent.- Parameters:
name
- the name of the shared thread pool.monitor
- the monitor used to cancel jobs.
-
Worker
public Worker(String name, boolean isPersistentThread, boolean useSharedThreadPool, TaskMonitor monitor) This constructor allows you to change persistence and shared thread pool usage.- Parameters:
name
- the name of the shared thread pool.isPersistentThread
- if true, the worker thread will stay around when idle; false means that the thread will go away if not needed. Should be true for high frequency usage.useSharedThreadPool
- true signals to use the given name to find/create a thread pool that can be shared throughout the system.monitor
- the monitor used to cancel jobs.
-
-
Method Details
-
createGuiWorker
A convenience method to create a Worker that uses a shared thread pool for performing operations for GUI clients in a background threadNote: the shared thread pool of the worker created here has a max number of threads as defined by
SystemUtilities.getDefaultThreadPoolSize()
. If there is a point in time where we notice contention in thread due to too many clients of this method (i.e., too many tasks are blocking because the thread pool is full), then we can update the size of the thread pool for this Worker.- Returns:
- the new worker
-