module Bindings.GLib.CoreApplicationSupport.Threads where
import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word
import Bindings.GLib.Fundamentals
import Bindings.GLib.Utilities.DateAndTimeFunctions
import Bindings.GLib.DataTypes.Datasets
import Bindings.GLib.DataTypes.DoublyLinkedLists
import Bindings.GLib.CoreApplicationSupport.ErrorReporting
c'G_THREAD_ERROR = 1
c'G_THREAD_ERROR :: (Num a) => a
type C'GThreadError = CUInt
c'G_THREAD_ERROR_AGAIN = 0
c'G_THREAD_ERROR_AGAIN :: (Num a) => a
data C'GThreadFunctions = C'GThreadFunctions{
c'GThreadFunctions'mutex_new :: FunPtr (IO (Ptr C'GMutex))
,
c'GThreadFunctions'mutex_lock :: FunPtr (Ptr C'GMutex -> IO ())
,
c'GThreadFunctions'mutex_trylock :: FunPtr (Ptr C'GMutex -> IO C'gboolean)
,
c'GThreadFunctions'mutex_unlock :: FunPtr (Ptr C'GMutex -> IO ())
,
c'GThreadFunctions'mutex_free :: FunPtr (Ptr C'GMutex -> IO ())
,
c'GThreadFunctions'cond_new :: FunPtr (IO (Ptr C'GCond))
,
c'GThreadFunctions'cond_signal :: FunPtr (Ptr C'GCond -> IO ())
,
c'GThreadFunctions'cond_broadcast :: FunPtr (Ptr C'GCond -> IO ())
,
c'GThreadFunctions'cond_wait :: FunPtr (Ptr C'GCond -> Ptr C'GMutex -> IO ())
,
c'GThreadFunctions'cond_timed_wait :: FunPtr (Ptr C'GCond -> Ptr C'GMutex -> Ptr C'GTimeVal -> IO C'gboolean)
,
c'GThreadFunctions'cond_free :: FunPtr (Ptr C'GCond -> IO ())
,
c'GThreadFunctions'private_new :: FunPtr (C'GDestroyNotify -> IO (Ptr C'GPrivate))
,
c'GThreadFunctions'private_get :: FunPtr (Ptr C'GPrivate -> IO C'gpointer)
,
c'GThreadFunctions'private_set :: FunPtr (Ptr C'GPrivate -> C'gpointer -> IO ())
,
c'GThreadFunctions'thread_create :: FunPtr (C'GThreadFunc -> C'gpointer -> C'gulong -> C'gboolean -> C'gboolean -> C'GThreadPriority -> C'gpointer -> Ptr (Ptr C'GError) -> IO ())
,
c'GThreadFunctions'thread_yield :: FunPtr (IO ())
,
c'GThreadFunctions'thread_join :: FunPtr (C'gpointer -> IO ())
,
c'GThreadFunctions'thread_exit :: FunPtr (IO ())
,
c'GThreadFunctions'thread_set_priority :: FunPtr (C'gpointer -> C'GThreadPriority -> IO ())
,
c'GThreadFunctions'thread_self :: FunPtr (C'gpointer -> IO ())
,
c'GThreadFunctions'thread_equal :: FunPtr (C'gpointer -> C'gpointer -> IO C'gboolean)
} deriving (Eq,Show)
instance Storable C'GThreadFunctions where
sizeOf _ = 84
alignment = sizeOf
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 4
v2 <- peekByteOff p 8
v3 <- peekByteOff p 12
v4 <- peekByteOff p 16
v5 <- peekByteOff p 20
v6 <- peekByteOff p 24
v7 <- peekByteOff p 28
v8 <- peekByteOff p 32
v9 <- peekByteOff p 36
v10 <- peekByteOff p 40
v11 <- peekByteOff p 44
v12 <- peekByteOff p 48
v13 <- peekByteOff p 52
v14 <- peekByteOff p 56
v15 <- peekByteOff p 60
v16 <- peekByteOff p 64
v17 <- peekByteOff p 68
v18 <- peekByteOff p 72
v19 <- peekByteOff p 76
v20 <- peekByteOff p 80
return $ C'GThreadFunctions v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20
poke p (C'GThreadFunctions v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11 v12 v13 v14 v15 v16 v17 v18 v19 v20) = do
pokeByteOff p 0 v0
pokeByteOff p 4 v1
pokeByteOff p 8 v2
pokeByteOff p 12 v3
pokeByteOff p 16 v4
pokeByteOff p 20 v5
pokeByteOff p 24 v6
pokeByteOff p 28 v7
pokeByteOff p 32 v8
pokeByteOff p 36 v9
pokeByteOff p 40 v10
pokeByteOff p 44 v11
pokeByteOff p 48 v12
pokeByteOff p 52 v13
pokeByteOff p 56 v14
pokeByteOff p 60 v15
pokeByteOff p 64 v16
pokeByteOff p 68 v17
pokeByteOff p 72 v18
pokeByteOff p 76 v19
pokeByteOff p 80 v20
return ()
foreign import ccall "g_thread_init" c'g_thread_init
:: Ptr C'GThreadFunctions -> IO ()
foreign import ccall "&g_thread_init" p'g_thread_init
:: FunPtr (Ptr C'GThreadFunctions -> IO ())
foreign import ccall "g_thread_supported" c'g_thread_supported
:: IO C'gboolean
foreign import ccall "&g_thread_supported" p'g_thread_supported
:: FunPtr (IO C'gboolean)
foreign import ccall "g_thread_get_initialized" c'g_thread_get_initialized
:: IO C'gboolean
foreign import ccall "&g_thread_get_initialized" p'g_thread_get_initialized
:: FunPtr (IO C'gboolean)
type C'GThreadFunc = FunPtr (C'gpointer -> IO C'gpointer)
foreign import ccall "wrapper" mk'GThreadFunc
:: (C'gpointer -> IO C'gpointer) -> IO C'GThreadFunc
type C'GThreadPriority = CUInt
c'G_THREAD_PRIORITY_LOW = 0
c'G_THREAD_PRIORITY_LOW :: (Num a) => a
c'G_THREAD_PRIORITY_NORMAL = 1
c'G_THREAD_PRIORITY_NORMAL :: (Num a) => a
c'G_THREAD_PRIORITY_HIGH = 2
c'G_THREAD_PRIORITY_HIGH :: (Num a) => a
c'G_THREAD_PRIORITY_URGENT = 3
c'G_THREAD_PRIORITY_URGENT :: (Num a) => a
data C'GThread = C'GThread
foreign import ccall "g_thread_create" c'g_thread_create
:: C'GThreadFunc -> C'gpointer -> C'gboolean -> Ptr (Ptr C'GError) -> IO (Ptr C'GThread)
foreign import ccall "&g_thread_create" p'g_thread_create
:: FunPtr (C'GThreadFunc -> C'gpointer -> C'gboolean -> Ptr (Ptr C'GError) -> IO (Ptr C'GThread))
foreign import ccall "g_thread_create_full" c'g_thread_create_full
:: C'GThreadFunc -> C'gpointer -> C'gulong -> C'gboolean -> C'gboolean -> C'GThreadPriority -> Ptr (Ptr C'GError) -> IO (Ptr C'GThread)
foreign import ccall "&g_thread_create_full" p'g_thread_create_full
:: FunPtr (C'GThreadFunc -> C'gpointer -> C'gulong -> C'gboolean -> C'gboolean -> C'GThreadPriority -> Ptr (Ptr C'GError) -> IO (Ptr C'GThread))
foreign import ccall "g_thread_self" c'g_thread_self
:: IO (Ptr C'GThread)
foreign import ccall "&g_thread_self" p'g_thread_self
:: FunPtr (IO (Ptr C'GThread))
foreign import ccall "g_thread_join" c'g_thread_join
:: Ptr C'GThread -> IO C'gpointer
foreign import ccall "&g_thread_join" p'g_thread_join
:: FunPtr (Ptr C'GThread -> IO C'gpointer)
foreign import ccall "g_thread_set_priority" c'g_thread_set_priority
:: Ptr C'GThread -> C'GThreadPriority -> IO ()
foreign import ccall "&g_thread_set_priority" p'g_thread_set_priority
:: FunPtr (Ptr C'GThread -> C'GThreadPriority -> IO ())
foreign import ccall "g_thread_yield" c'g_thread_yield
:: IO ()
foreign import ccall "&g_thread_yield" p'g_thread_yield
:: FunPtr (IO ())
foreign import ccall "g_thread_exit" c'g_thread_exit
:: C'gpointer -> IO ()
foreign import ccall "&g_thread_exit" p'g_thread_exit
:: FunPtr (C'gpointer -> IO ())
foreign import ccall "g_thread_foreach" c'g_thread_foreach
:: C'GFunc -> C'gpointer -> IO ()
foreign import ccall "&g_thread_foreach" p'g_thread_foreach
:: FunPtr (C'GFunc -> C'gpointer -> IO ())
data C'GMutex = C'GMutex
foreign import ccall "g_mutex_new" c'g_mutex_new
:: IO (Ptr C'GMutex)
foreign import ccall "&g_mutex_new" p'g_mutex_new
:: FunPtr (IO (Ptr C'GMutex))
foreign import ccall "g_mutex_lock" c'g_mutex_lock
:: Ptr C'GMutex -> IO ()
foreign import ccall "&g_mutex_lock" p'g_mutex_lock
:: FunPtr (Ptr C'GMutex -> IO ())
foreign import ccall "g_mutex_trylock" c'g_mutex_trylock
:: Ptr C'GMutex -> IO C'gboolean
foreign import ccall "&g_mutex_trylock" p'g_mutex_trylock
:: FunPtr (Ptr C'GMutex -> IO C'gboolean)
foreign import ccall "g_mutex_unlock" c'g_mutex_unlock
:: Ptr C'GMutex -> IO ()
foreign import ccall "&g_mutex_unlock" p'g_mutex_unlock
:: FunPtr (Ptr C'GMutex -> IO ())
foreign import ccall "g_mutex_free" c'g_mutex_free
:: Ptr C'GMutex -> IO ()
foreign import ccall "&g_mutex_free" p'g_mutex_free
:: FunPtr (Ptr C'GMutex -> IO ())
data C'GStaticMutex = C'GStaticMutex{
} deriving (Eq,Show)
instance Storable C'GStaticMutex where
sizeOf _ = 28
alignment = sizeOf
peek p = do
return $ C'GStaticMutex
poke p (C'GStaticMutex) = do
return ()
foreign import ccall "inline_g_static_mutex_init" c'g_static_mutex_init
:: Ptr C'GStaticMutex -> IO ()
foreign import ccall "inline_g_static_mutex_lock" c'g_static_mutex_lock
:: Ptr C'GStaticMutex -> IO ()
foreign import ccall "inline_g_static_mutex_trylock" c'g_static_mutex_trylock
:: Ptr C'GStaticMutex -> IO C'gboolean
foreign import ccall "inline_g_static_mutex_unlock" c'g_static_mutex_unlock
:: Ptr C'GStaticMutex -> IO ()
foreign import ccall "inline_g_static_mutex_get_mutex" c'g_static_mutex_get_mutex
:: Ptr C'GStaticMutex -> IO (Ptr C'GMutex)
foreign import ccall "inline_g_static_mutex_free" c'g_static_mutex_free
:: Ptr C'GStaticMutex -> IO ()
data C'GStaticRecMutex = C'GStaticRecMutex{
} deriving (Eq,Show)
instance Storable C'GStaticRecMutex where
sizeOf _ = 40
alignment = sizeOf
peek p = do
return $ C'GStaticRecMutex
poke p (C'GStaticRecMutex) = do
return ()
foreign import ccall "g_static_rec_mutex_init" c'g_static_rec_mutex_init
:: Ptr C'GStaticRecMutex -> IO ()
foreign import ccall "&g_static_rec_mutex_init" p'g_static_rec_mutex_init
:: FunPtr (Ptr C'GStaticRecMutex -> IO ())
foreign import ccall "g_static_rec_mutex_lock" c'g_static_rec_mutex_lock
:: Ptr C'GStaticRecMutex -> IO ()
foreign import ccall "&g_static_rec_mutex_lock" p'g_static_rec_mutex_lock
:: FunPtr (Ptr C'GStaticRecMutex -> IO ())
foreign import ccall "g_static_rec_mutex_trylock" c'g_static_rec_mutex_trylock
:: Ptr C'GStaticRecMutex -> IO C'gboolean
foreign import ccall "&g_static_rec_mutex_trylock" p'g_static_rec_mutex_trylock
:: FunPtr (Ptr C'GStaticRecMutex -> IO C'gboolean)
foreign import ccall "g_static_rec_mutex_unlock" c'g_static_rec_mutex_unlock
:: Ptr C'GStaticRecMutex -> IO ()
foreign import ccall "&g_static_rec_mutex_unlock" p'g_static_rec_mutex_unlock
:: FunPtr (Ptr C'GStaticRecMutex -> IO ())
foreign import ccall "g_static_rec_mutex_lock_full" c'g_static_rec_mutex_lock_full
:: Ptr C'GStaticRecMutex -> C'guint -> IO ()
foreign import ccall "&g_static_rec_mutex_lock_full" p'g_static_rec_mutex_lock_full
:: FunPtr (Ptr C'GStaticRecMutex -> C'guint -> IO ())
foreign import ccall "g_static_rec_mutex_unlock_full" c'g_static_rec_mutex_unlock_full
:: Ptr C'GStaticRecMutex -> IO C'guint
foreign import ccall "&g_static_rec_mutex_unlock_full" p'g_static_rec_mutex_unlock_full
:: FunPtr (Ptr C'GStaticRecMutex -> IO C'guint)
foreign import ccall "g_static_rec_mutex_free" c'g_static_rec_mutex_free
:: Ptr C'GStaticRecMutex -> IO ()
foreign import ccall "&g_static_rec_mutex_free" p'g_static_rec_mutex_free
:: FunPtr (Ptr C'GStaticRecMutex -> IO ())
data C'GStaticRWLock = C'GStaticRWLock{
} deriving (Eq,Show)
instance Storable C'GStaticRWLock where
sizeOf _ = 52
alignment = sizeOf
peek p = do
return $ C'GStaticRWLock
poke p (C'GStaticRWLock) = do
return ()
foreign import ccall "g_static_rw_lock_init" c'g_static_rw_lock_init
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_init" p'g_static_rw_lock_init
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
foreign import ccall "g_static_rw_lock_reader_lock" c'g_static_rw_lock_reader_lock
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_reader_lock" p'g_static_rw_lock_reader_lock
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
foreign import ccall "g_static_rw_lock_reader_trylock" c'g_static_rw_lock_reader_trylock
:: Ptr C'GStaticRWLock -> IO C'gboolean
foreign import ccall "&g_static_rw_lock_reader_trylock" p'g_static_rw_lock_reader_trylock
:: FunPtr (Ptr C'GStaticRWLock -> IO C'gboolean)
foreign import ccall "g_static_rw_lock_reader_unlock" c'g_static_rw_lock_reader_unlock
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_reader_unlock" p'g_static_rw_lock_reader_unlock
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
foreign import ccall "g_static_rw_lock_writer_lock" c'g_static_rw_lock_writer_lock
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_writer_lock" p'g_static_rw_lock_writer_lock
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
foreign import ccall "g_static_rw_lock_writer_trylock" c'g_static_rw_lock_writer_trylock
:: Ptr C'GStaticRWLock -> IO C'gboolean
foreign import ccall "&g_static_rw_lock_writer_trylock" p'g_static_rw_lock_writer_trylock
:: FunPtr (Ptr C'GStaticRWLock -> IO C'gboolean)
foreign import ccall "g_static_rw_lock_writer_unlock" c'g_static_rw_lock_writer_unlock
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_writer_unlock" p'g_static_rw_lock_writer_unlock
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
foreign import ccall "g_static_rw_lock_free" c'g_static_rw_lock_free
:: Ptr C'GStaticRWLock -> IO ()
foreign import ccall "&g_static_rw_lock_free" p'g_static_rw_lock_free
:: FunPtr (Ptr C'GStaticRWLock -> IO ())
data C'GCond = C'GCond
foreign import ccall "g_cond_new" c'g_cond_new
:: IO (Ptr C'GCond)
foreign import ccall "&g_cond_new" p'g_cond_new
:: FunPtr (IO (Ptr C'GCond))
foreign import ccall "g_cond_signal" c'g_cond_signal
:: Ptr C'GCond -> ()
foreign import ccall "&g_cond_signal" p'g_cond_signal
:: FunPtr (Ptr C'GCond -> ())
foreign import ccall "g_cond_broadcast" c'g_cond_broadcast
:: Ptr C'GCond -> ()
foreign import ccall "&g_cond_broadcast" p'g_cond_broadcast
:: FunPtr (Ptr C'GCond -> ())
foreign import ccall "g_cond_wait" c'g_cond_wait
:: Ptr C'GCond -> Ptr C'GMutex -> IO ()
foreign import ccall "&g_cond_wait" p'g_cond_wait
:: FunPtr (Ptr C'GCond -> Ptr C'GMutex -> IO ())
foreign import ccall "g_cond_timed_wait" c'g_cond_timed_wait
:: Ptr C'GCond -> Ptr C'GMutex -> Ptr C'GTimeVal -> IO C'gboolean
foreign import ccall "&g_cond_timed_wait" p'g_cond_timed_wait
:: FunPtr (Ptr C'GCond -> Ptr C'GMutex -> Ptr C'GTimeVal -> IO C'gboolean)
foreign import ccall "g_cond_free" c'g_cond_free
:: Ptr C'GCond -> IO ()
foreign import ccall "&g_cond_free" p'g_cond_free
:: FunPtr (Ptr C'GCond -> IO ())
data C'GPrivate = C'GPrivate
foreign import ccall "g_private_new" c'g_private_new
:: C'GDestroyNotify -> IO (Ptr C'GPrivate)
foreign import ccall "&g_private_new" p'g_private_new
:: FunPtr (C'GDestroyNotify -> IO (Ptr C'GPrivate))
foreign import ccall "g_private_get" c'g_private_get
:: Ptr C'GPrivate -> IO C'gpointer
foreign import ccall "&g_private_get" p'g_private_get
:: FunPtr (Ptr C'GPrivate -> IO C'gpointer)
foreign import ccall "g_private_set" c'g_private_set
:: Ptr C'GPrivate -> C'gpointer -> IO ()
foreign import ccall "&g_private_set" p'g_private_set
:: FunPtr (Ptr C'GPrivate -> C'gpointer -> IO ())
data C'GStaticPrivate = C'GStaticPrivate{
} deriving (Eq,Show)
instance Storable C'GStaticPrivate where
sizeOf _ = 4
alignment = sizeOf
peek p = do
return $ C'GStaticPrivate
poke p (C'GStaticPrivate) = do
return ()
foreign import ccall "g_static_private_init" c'g_static_private_init
:: Ptr C'GStaticPrivate -> IO ()
foreign import ccall "&g_static_private_init" p'g_static_private_init
:: FunPtr (Ptr C'GStaticPrivate -> IO ())
foreign import ccall "g_static_private_get" c'g_static_private_get
:: Ptr C'GStaticPrivate -> IO C'gpointer
foreign import ccall "&g_static_private_get" p'g_static_private_get
:: FunPtr (Ptr C'GStaticPrivate -> IO C'gpointer)
foreign import ccall "g_static_private_set" c'g_static_private_set
:: Ptr C'GStaticPrivate -> C'gpointer -> C'GDestroyNotify -> IO ()
foreign import ccall "&g_static_private_set" p'g_static_private_set
:: FunPtr (Ptr C'GStaticPrivate -> C'gpointer -> C'GDestroyNotify -> IO ())
foreign import ccall "g_static_private_free" c'g_static_private_free
:: Ptr C'GStaticPrivate -> IO ()
foreign import ccall "&g_static_private_free" p'g_static_private_free
:: FunPtr (Ptr C'GStaticPrivate -> IO ())
data C'GOnce = C'GOnce{
c'GOnce'status :: C'GOnceStatus
,
c'GOnce'retval :: C'gpointer
} deriving (Eq,Show)
instance Storable C'GOnce where
sizeOf _ = 8
alignment = sizeOf
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 4
return $ C'GOnce v0 v1
poke p (C'GOnce v0 v1) = do
pokeByteOff p 0 v0
pokeByteOff p 4 v1
return ()
type C'GOnceStatus = CUInt
c'G_ONCE_STATUS_NOTCALLED = 0
c'G_ONCE_STATUS_NOTCALLED :: (Num a) => a
c'G_ONCE_STATUS_PROGRESS = 1
c'G_ONCE_STATUS_PROGRESS :: (Num a) => a
c'G_ONCE_STATUS_READY = 2
c'G_ONCE_STATUS_READY :: (Num a) => a
foreign import ccall "g_once_init_enter" c'g_once_init_enter
:: Ptr C'gsize -> IO C'gboolean
foreign import ccall "&g_once_init_enter" p'g_once_init_enter
:: FunPtr (Ptr C'gsize -> IO C'gboolean)
foreign import ccall "g_once_init_leave" c'g_once_init_leave
:: Ptr C'gsize -> C'gsize -> IO ()
foreign import ccall "&g_once_init_leave" p'g_once_init_leave
:: FunPtr (Ptr C'gsize -> C'gsize -> IO ())