The dog whistle produces a higher pitched sound that only dogs can hear and us humans cannot hear the high pitched whistle sounds.
The dogs hate the sound of a dog whistle and it will stop them from barking because when they start to bark and hear that whistle they will go and hide and shut up.
You should only use the dog whistle when the dog is barking though so they will get the hint and stop barking whenever you use the dog whistle.
I've used a dog whistle on my neighbors dogs before and every time I use the dog whistle when the dogs bark they shut up really quick and go hide.