The Boatswain's whistle is a small whistle that was used aboard old sailing ships and was still used on starships up to the 24th Century.
Aboard starships, it is normally used when an honorary guest comes aboard or at a crew members funeral, when they are released into space.
When an Excalbian replica of Abraham Lincoln came aboard the Enterprise Lieutenant Dickerson blew a boatswain's whistle. (TOS: "The Savage Curtain")
Yeoman Samno blew a boatswain's whistle when the Klingon Chancellor Gorkon came aboard the Enterprise-A in 2293. (Star Trek VI: The Undiscovered Country).
In 2373, Captain Janeway hallucinated her own death and funeral aboard 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")