wayland_read_intent - Man Page

Represents an intention to read from the display file descriptor.

Synopsis

#include <wayland-client.hpp>

Public Member Functions

bool is_finalized () const
Check whether this intent was already finalized with cancel or read.
void cancel ()
Cancel read intent.
void read ()
Read events from display file descriptor.

Detailed Description

Represents an intention to read from the display file descriptor.

When not using the convenience method display_t::dispatch that takes care of this automatically, threads that want to read events from a Wayland display file descriptor must announce their intention to do so beforehand - in the C API, this is done using wl_display_prepare_read. This intention must then be resolved either by actually invoking a read from the file descriptor or cancelling.

This RAII class makes sure that when it goes out of scope, the intent is cancelled automatically if it was not finalized by manually cancelling or reading before. Otherwise, it would be easy to forget resolving the intent e.g. when handling errors, potentially leading to a deadlock.

Read intents can only be created by a display_t with display_t::obtain_read_intent and display_t::obtain_queue_read_intent.

Undefined behavior occurs when the associated display_t or event_queue_t is destroyed when a read_intent has not been finalized yet.

Definition at line 371 of file wayland-client.hpp.

Member Function Documentation

void wayland::read_intent::cancel ()

Cancel read intent. An exception is thrown when the read intent was already finalized.

bool wayland::read_intent::is_finalized () const

Check whether this intent was already finalized with cancel or read.

void wayland::read_intent::read ()

Read events from display file descriptor. This will read events from the file descriptor for the display. This function does not dispatch events, it only reads and queues events into their corresponding event queues. If no data is avilable on the file descriptor, read() returns immediately. To dispatch events that may have been queued, call display_t::dispatch_pending or display_t::dispatch_queue_pending.

An exception is thrown when the read intent was already finalized. Each read intent can only be used for reading once. A new one must be obtained for any further read requests.

Author

Generated automatically by Doxygen for Wayland++ from the source code.

Info

Sat Jul 20 2024 00:00:00 Version 1.0.0 Wayland++