sync/[0,1] and sync_discard/[0,1]
     sync
     sync(+Display)
     sync_discard
     sync_discard(+Display)
     

Flush the output buffer of Display and wait until all request have been processed by the server. If Display is omitted, we default to syncing all open displays. sync_discard/[0,1] also throw away all queued events.