Hoogle Search
Within LTS Haskell 24.68 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
sourceGetReadyTime :: (HasCallStack, MonadIO m) => Source -> m Int64gi-glib GI.GLib.Structs.Source Gets the "ready time" of source, as set by sourceSetReadyTime. Any time before or equal to the current monotonic time (including 0) is an indication that the source will fire immediately.
sourceSetReadyTime :: (HasCallStack, MonadIO m) => Source -> Int64 -> m ()gi-glib GI.GLib.Structs.Source Sets a Source to be dispatched when the given monotonic time is reached (or passed). If the monotonic time is in the past (as it always will be if readyTime is 0) then the source will be dispatched immediately. If readyTime is -1 then the source is never woken up on the basis of the passage of time. Dispatching the source does not reset the ready time. You should do so yourself, from the source dispatch function. Note that if you have a pair of sources where the ready time of one suggests that it will be delivered first but the priority for the other suggests that it would be delivered first, and the ready time for both sources is reached during the same main context iteration, then the order of dispatch is undefined. It is a no-op to call this function on a Source which has already been destroyed with sourceDestroy. This API is only intended to be used by implementations of Source. Do not call this API on a Source that you did not create. Since: 2.36
-
The Thread struct represents a running thread. This struct is returned by threadNew or threadTryNew. You can obtain the Thread struct representing the current thread by calling threadSelf. GThread is refcounted, see threadRef and threadUnref. The thread represented by it holds a reference while it is running, and threadJoin consumes the reference that it is given, so it is normally not necessary to manage GThread references explicitly. The structure is opaque -- none of its fields may be directly accessed.
-
gi-glib GI.GLib.Structs.Thread Memory-managed wrapper type.
Thread :: ManagedPtr Thread -> Threadgi-glib GI.GLib.Structs.Thread No documentation available.
newZeroThread :: MonadIO m => m Threadgi-glib GI.GLib.Structs.Thread Construct a Thread struct initialized to zero.
threadErrorQuark :: (HasCallStack, MonadIO m) => m Word32gi-glib GI.GLib.Structs.Thread No description available in the introspection data.
threadExit :: (HasCallStack, MonadIO m) => Ptr () -> m ()gi-glib GI.GLib.Structs.Thread Terminates the current thread. If another thread is waiting for us using threadJoin then the waiting thread will be woken up and get retval as the return value of threadJoin. Calling threadExit with a parameter retval is equivalent to returning retval from the function func, as given to threadNew. You must only call threadExit from a thread that you created yourself with threadNew or related APIs. You must not call this function from a thread created with another threading library or or from within a ThreadPool.
threadJoin :: (HasCallStack, MonadIO m) => Thread -> m (Ptr ())gi-glib GI.GLib.Structs.Thread Waits until thread finishes, i.e. the function func, as given to threadNew, returns or threadExit is called. If thread has already terminated, then threadJoin returns immediately. Any thread can wait for any other thread by calling threadJoin, not just its 'creator'. Calling threadJoin from multiple threads for the same thread leads to undefined behaviour. The value returned by func or given to threadExit is returned by this function. threadJoin consumes the reference to the passed-in thread. This will usually cause the Thread struct and associated resources to be freed. Use threadRef to obtain an extra reference if you want to keep the GThread alive beyond the threadJoin call.
threadNew :: (HasCallStack, MonadIO m) => Maybe Text -> ThreadFunc -> m Threadgi-glib GI.GLib.Structs.Thread This function creates a new thread. The new thread starts by invoking func with the argument data. The thread will run until func returns or until threadExit is called from the new thread. The return value of func becomes the return value of the thread, which can be obtained with threadJoin. The name can be useful for discriminating threads in a debugger. It is not used for other purposes and does not have to be unique. Some systems restrict the length of name to 16 bytes. If the thread can not be created the program aborts. See threadTryNew if you want to attempt to deal with failures. If you are using threads to offload (potentially many) short-lived tasks, ThreadPool may be more appropriate than manually spawning and tracking multiple GThreads. To free the struct returned by this function, use threadUnref. Note that threadJoin implicitly unrefs the Thread as well. New threads by default inherit their scheduler policy (POSIX) or thread priority (Windows) of the thread creating the new thread. This behaviour changed in GLib 2.64: before threads on Windows were not inheriting the thread priority but were spawned with the default priority. Starting with GLib 2.64 the behaviour is now consistent between Windows and POSIX and all threads inherit their parent thread's priority. Since: 2.32