We use Locks and Latches plugin to implement multiple jobs but one same build queue.
It has a bug. When both A,B jobs are in build queue, and are executed at the same time. The lock for A and B is not available.
Another plugin Build Blocker Plugin has similar function
Step 1
Set in Configuration System
Step 2,
Set lock in your jobs.