### Method

# GLib MainContext query

#### Declaration

    gint
    g_main_context_query (
      GMainContext* context,
      gint max_priority,
      gint* timeout_,
      GPollFD* fds,
      gint n_fds
    )

#### Description

Determines information necessary to poll this main loop. You should be careful to pass the resulting `fds` array and its length `n_fds` as is when calling g_main_context_check(), as this function relies on assumptions made when the array is filled.

You must have successfully acquired the context with `g_main_context_acquire()` before you may call this function.

#### Parameters

`max_priority`

  Type: `gint`

  Maximum priority source to check.

`timeout_`

  Type: `gint*`

  Location to store timeout to be used in polling.

  The argument will be set by the function.

`fds`

  Type: An array of `GPollFD`

  Location to store `GPollFD` records that need to be polled.

  The argument will be set by the function.
  The length of the array is specified in the `n_fds` argument.
  The returned data is owned by the instance.

`n_fds`

  Type: `gint`

  Length of `fds`.

#### Return value

Type: `gint`

The number of records actually stored in `fds`, or, if more than `n_fds` records need to be stored, the number of records that need to be stored.