To increase your swimming pool total alkalinity level you can use sodium bicarbonate which is nothing more than baking soda. It's safe to swim immediately after adding but you'll want to see these links on how to raise your pool alkalinity.
You can swim 2 hours after adding, but if you can, allow for one full turn-over of the water. A turn-over is a full and complete filtration of all of the swimming pool water, normally about 10 hours. This is why you'll want to make any adjustments at night.
A pool shock is a different story. It's not necessarily a time factor but when the pool chlorine level gets down to a safe level, about 1.5ppm - 3.5ppm.
The swimming pool chlorine level normally takes a few days to reach a safe level. If you need it faster you can use a product called Thiosulphate which is a pool chlorine neutralizer. You can get this at any pool supply store.
For other chemicals a 2 hour wait should be fine but for the best water quality, one complete turn-over.