Vegetable Barley Soup with Poached Egg

1 medium onion, chopped
2 garlic cloves, chopped
1 tablespoon olive oil
1/2 pound fresh shiitake mushrooms
1 teaspoon chopped
thyme
1 (14 1/2-ounce) can diced
fire-roasted tomatoes
1 qt vegetable stock or broth
3/4 cup quick-cooking barley
5 ounces baby spinach (8 cups)
1 tablespoon distilled white vinegar (optional)
4 large eggs (optional)
*
Garnish: grated Parmigiano-Reggiano

Cook onion and garlic with 1/2 teaspoon salt in oil in a large heavy saucepan over medium heat, stirring occasionally, until pale golden, about 10 minutes. Meanwhile, discard stems from mushrooms. Halve caps, then thinly slice crosswise. Add mushrooms and thyme to onion and cook, stirring occasionally, until mushrooms are softened, about 5 minutes. Stir in tomatoes with their juice, stock, barley, and 1/2 teaspoon each of salt and pepper and simmer briskly, covered, stirring occasionally, until barley is tender, 10 to 15 minutes. Stir in spinach and cook 1 minute, then season with salt. Meanwhile (if using eggs), bring 2 quarts water to a simmer with vinegar and 1 tablespoon salt in a wide medium saucepan. Break 1 egg into a cup and slide into water. Repeat with remaining eggs, spacing evenly. Poach at a bare simmer until whites are firm and yolks are still runny, 2 to 3 minutes. Transfer to paper towels using a slotted spoon. Serve soup in bowls, topped with eggs.