You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In practice AbstractIrpQueue spawns a new thread whenever an Irp is added. For asyncSubmit this makes a little sense, though reusing the a single thread per pipe would be a lot better. For the syncSubmit usecase it makes no sense to do this. It is very resource intense. By making the following modification I was able to increase performance by a factor of 10x.
public final void add(final T irp)
{
this.irps.add(irp);
// Start the queue processor if not already running.
// if (this.processor == null)
// {
// this.processor = new Thread(new Runnable()
// {
// @Override
// public void run()
// {
process();
// }
// });
// this.processor.setDaemon(true);
// this.processor.setName("usb4java IRP Queue Processor");
// this.processor.start();
// }
}
When using syncSubmit an Irp is added to the queue, and the processor thread is started, when the processor finishes executing the Irp the thread is destroyed again. Meanwhile the syncSubmit thread is waiting. A cleaner solution might be to wait() the processor thread until a new irp is added. That would work for asyncSubmit too. But is not relevant for my usecase.
The text was updated successfully, but these errors were encountered:
In practice AbstractIrpQueue spawns a new thread whenever an Irp is added. For asyncSubmit this makes a little sense, though reusing the a single thread per pipe would be a lot better. For the syncSubmit usecase it makes no sense to do this. It is very resource intense. By making the following modification I was able to increase performance by a factor of 10x.
When using syncSubmit an Irp is added to the queue, and the processor thread is started, when the processor finishes executing the Irp the thread is destroyed again. Meanwhile the syncSubmit thread is waiting. A cleaner solution might be to wait() the processor thread until a new irp is added. That would work for asyncSubmit too. But is not relevant for my usecase.
The text was updated successfully, but these errors were encountered: