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.
threadRef :: (HasCallStack, MonadIO m) => Thread -> m Threadgi-glib GI.GLib.Structs.Thread Increase the reference count on thread. Since: 2.32
threadSelf :: (HasCallStack, MonadIO m) => m Threadgi-glib GI.GLib.Structs.Thread This function returns the Thread corresponding to the current thread. Note that this function does not increase the reference count of the returned struct. This function will return a Thread even for threads that were not created by GLib (i.e. those created by other threading APIs). This may be useful for thread identification purposes (i.e. comparisons) but you must not use GLib functions (such as threadJoin) on these threads.
threadTryNew :: (HasCallStack, MonadIO m) => Maybe Text -> ThreadFunc -> m Threadgi-glib GI.GLib.Structs.Thread This function is the same as threadNew except that it allows for the possibility of failure. If a thread can not be created (due to resource limits), error is set and Nothing is returned. Since: 2.32
threadUnref :: (HasCallStack, MonadIO m) => Thread -> m ()gi-glib GI.GLib.Structs.Thread Decrease the reference count on thread, possibly freeing all resources associated with it. Note that each thread holds a reference to its Thread while it is running, so it is safe to drop your own reference to it if you don't need it anymore. Since: 2.32
threadYield :: (HasCallStack, MonadIO m) => m ()gi-glib GI.GLib.Structs.Thread Causes the calling thread to voluntarily relinquish the CPU, so that other threads can run. This function is often used as a method to make busy wait less evil.
module GI.GLib.Structs.
ThreadPool The GThreadPool struct represents a thread pool. A thread pool is useful when you wish to asynchronously fork out the execution of work and continue working in your own thread. If that will happen often, the overhead of starting and destroying a thread each time might be too high. In such cases reusing already started threads seems like a good idea. And it indeed is, but implementing this can be tedious and error-prone. Therefore GLib provides thread pools for your convenience. An added advantage is, that the threads can be shared between the different subsystems of your program, when they are using GLib. To create a new thread pool, you use ThreadPool.new(). It is destroyed by threadPoolFree. If you want to execute a certain task within a thread pool, use threadPoolPush. To get the current number of running threads you call threadPoolGetNumThreads. To get the number of still unprocessed tasks you call threadPoolUnprocessed. To control the maximum number of threads for a thread pool, you use threadPoolGetMaxThreads. and threadPoolSetMaxThreads. Finally you can control the number of unused threads, that are kept alive by GLib for future use. The current number can be fetched with threadPoolGetNumUnusedThreads. The maximum number can be controlled by threadPoolGetMaxUnusedThreads and threadPoolSetMaxUnusedThreads. All currently unused threads can be stopped by calling threadPoolStopUnusedThreads.
-
gi-glib GI.GLib.Structs.ThreadPool Memory-managed wrapper type.
ThreadPool :: ManagedPtr ThreadPool -> ThreadPoolgi-glib GI.GLib.Structs.ThreadPool No documentation available.
clearThreadPoolFunc :: MonadIO m => ThreadPool -> m ()gi-glib GI.GLib.Structs.ThreadPool Set the value of the “func” field to Nothing. When overloading is enabled, this is equivalent to
clear #func
clearThreadPoolUserData :: MonadIO m => ThreadPool -> m ()gi-glib GI.GLib.Structs.ThreadPool Set the value of the “user_data” field to Nothing. When overloading is enabled, this is equivalent to
clear #userData