Function

Coglpoll_renderer_get_info

Declaration [src]

int
cogl_poll_renderer_get_info (
  CoglRenderer* renderer,
  CoglPollFD** poll_fds,
  int* n_poll_fds,
  int64_t* timeout
)

Description [src]

Is used to integrate Cogl with an application mainloop that is based on the unix poll(2) api (or select() or something equivalent). This api should be called whenever an application is about to go idle so that Cogl has a chance to describe what file descriptor events it needs to be woken up for.

If your application is using the Glib mainloop then you should jump to the cogl_glib_source_new() api as a more convenient way of integrating Cogl with the mainloop.

After the function is called *poll_fds will contain a pointer to an array of CoglPollFD structs describing the file descriptors that Cogl expects. The fd and events members will be updated accordingly. After the application has completed its idle it is expected to either update the revents members directly in this array or to create a copy of the array and update them there.

When the application mainloop returns from calling poll(2) (or its equivalent) then it should call cogl_poll_renderer_dispatch() passing a pointer the array of CoglPollFDs with updated revent values.

timeout will contain a maximum amount of time to wait in microseconds before the application should wake up or -1 if the application should wait indefinitely. This can also be 0 if Cogl needs to be woken up immediately.

Parameters

renderer

Type: CoglRenderer

A CoglRenderer.

The data is owned by the caller of the function.
poll_fds

Type: CoglPollFD

A return location for a pointer to an array of CoglPollFDs.

The data is owned by the caller of the function.
n_poll_fds

Type: int*

A return location for the number of entries in *poll_fds.

The data is owned by the caller of the function.
timeout

Type: int64_t*

A return location for the maximum length of time to wait in microseconds, or -1 to wait indefinitely.

The data is owned by the caller of the function.

Return value

Type: int

A “poll fd state age” that changes whenever the set of poll_fds has changed. If this API is being used to integrate with another system mainloop api then knowing if the set of file descriptors and events has really changed can help avoid redundant work depending the api. The age isn’t guaranteed to change when the timeout changes.