I asked for this months ago (it is after all documented) but
nothing seems to have been done.
It is now extremely urgent that I sort this out if I want
UniForM to work. What am I to do??
Things are now sufficiently desperate that I will attempt to
hack the GHC sources.
George,
Try the module below. It makes ThreadId an instance of Eq and Ord.
Simon
{-# OPTIONS -fglasgow-exts #-}
module Thread( cmpThread ) where
import PrelConc
import GlaExts
foreign import ccall "cmp_thread" unsafe cmp_thread :: Addr - Addr - Int
-- Returns -1, 0, 1
cmpThread :: ThreadId - ThreadId - Ordering
cmpThread (ThreadId t1) (ThreadId t2)
= case cmp_thread (unsafeCoerce# t1) (unsafeCoerce# t2) of
-1 - LT
0 - EQ
1 - GT
instance Eq ThreadId where
t1 == t2 = case t1 `cmpThread` t2 of
EQ- True
other - False
instance Ord ThreadId where
cmp = cmpThread