The boatswain's whistle (pronounced bosun's whistle) is a small whistle that was used aboard old sailing ships since the 15th century, usually to gain the attention of the crew, and was still used on starships up to the 24th century.
Aboard starships into the 24th century, it was normally used when an honorary guest comes aboard or at a crewmember's funeral, when their body was released into space. The shrill whistle was often played before a ship-wide or open frequency communication, usually made by the captain or other senior officer. (TNG: "Yesterday's Enterprise") The actual tone of the call has varied, as some captains prefer the distinctive notes of the electronic type over the more traditional metal whistle. (TNG: "Lower Decks")
In 2373, Captain Janeway hallucinated her own death and funeral aboard USS Voyager when a non-corporeal being tried to convince her she was dead, at which Crewman William McKenzie blew the whistle during her memorial. (VOY: "Coda")
In 2375, Nog blew the boatswain's whistle, at the wedding of Kasidy Yates and Benjamin Sisko, right before Kasidy entered the wardroom. Odo complimented him on his playing, despite Nog only having twenty minutes to learn it. (DS9: "'Til Death Do Us Part")