Event handling in C++ primarily consists of exceptions and signals. The exact details of how these are handled is best described in the specification or one of Stroustrup's books.
Other event handling, such as mouse clicks, interrupts, and semaphores, is handled by the OS. Different OSes have different API and set up requirements for handling events. Many multi-thread and multi-tasking OSes allow a program to sleep until an event occurs (such as a setting a semaphore, generating a signal or sending a message).
You need to have your program, or thread, signal the GUI when finished writing to a file. Signal is defined by your OS or GUI framework.
FYI, in most designs, buffers don't write to files. Programs, tasks, or execution threads write buffers to files. Having a buffer write to a file may generate more signaling or context switching than having a thread write a buffer to a file.