gi-gio-2.0.19: Gio bindings

Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com)
Safe Haskell | None
Language | Haskell2010

GI.Gio.Structs.IOSchedulerJob

Contents

- Exported types
- Methods
  - sendToMainloop
  - sendToMainloopAsync

Description

Opaque class for defining and scheduling IO jobs.

Synopsis

- newtype IOSchedulerJob = IOSchedulerJob (ManagedPtr IOSchedulerJob)
- noIOSchedulerJob :: Maybe IOSchedulerJob
- iOSchedulerJobSendToMainloop :: (HasCallStack, MonadIO m) => IOSchedulerJob -> SourceFunc -> m Bool
- iOSchedulerJobSendToMainloopAsync :: (HasCallStack, MonadIO m) => IOSchedulerJob -> SourceFunc -> m ()

# Exported types

newtype IOSchedulerJob Source #

Memory-managed wrapper type.

Constructors

IOSchedulerJob (ManagedPtr IOSchedulerJob) |

Instances

WrappedPtr IOSchedulerJob Source # |
Instance details Defined in GI.Gio.Structs.IOSchedulerJob Methods wrappedPtrCalloc :: IO (Ptr IOSchedulerJob) Source # wrappedPtrCopy :: IOSchedulerJob -> IO IOSchedulerJob Source # wrappedPtrFree :: Maybe (FunPtr (Ptr IOSchedulerJob -> IO ())) Source #

noIOSchedulerJob :: Maybe IOSchedulerJob Source #

A convenience alias for `Nothing` :: `Maybe` `IOSchedulerJob`.

# Methods

## sendToMainloop

iOSchedulerJobSendToMainloop Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> IOSchedulerJob | `job`: a `IOSchedulerJob`
-> SourceFunc | `func`: a `SourceFunc` callback that will be called in the original thread
-> m Bool | Returns: The return value of `func`

Deprecated: Use `g_main_context_invoke()`.

Used from an I/O job to send a callback to be run in the thread that the job was started from, waiting for the result (and thus blocking the I/O job).

## sendToMainloopAsync

iOSchedulerJobSendToMainloopAsync Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> IOSchedulerJob | `job`: a `IOSchedulerJob`
-> SourceFunc | `func`: a `SourceFunc` callback that will be called in the original thread
-> m () |

Deprecated: Use `g_main_context_invoke()`.

Used from an I/O job to send a callback to be run asynchronously in the thread that the job was started from. The callback will be run when the main loop is available, but at that time the I/O job might have finished. The return value from the callback is ignored.

Note that if you are passing the `userData` from `ioSchedulerPushJob` on to this function you have to ensure that it is not freed before `func` is called, either by passing `Nothing` as `notify` to `ioSchedulerPushJob` or by using refcounting for `userData`.