On Sat, Jan 17, 2009 at 02:42:28AM +0000, Ian Lynagh wrote:
> 
> I think I've found the problem: file_lock_mutex wasn't initialised. I'll
> validate etc tomorrow.

OK, that mostly worked, but ffi014 timed out.

It turns out that "hello world" linked with -threaded -debug deadlocks
at:
    ASSERT_LOCK_HELD(&sched_mutex);
at the start of newBoundTask. This is doing
    ASSERT(pthread_mutex_lock(&sched_mutex) == EDEADLK)
which requires us to be using error-checking mutexes. However, initMutex
says:
    void
    initMutex(Mutex* pMut)
    {
    #if defined(DEBUG)
        pthread_mutexattr_t attr;
        pthread_mutexattr_init(&attr);
        pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_ERRORCHECK_NP);
        pthread_mutex_init(pMut,&attr);
    #else
        pthread_mutex_init(pMut,NULL);
    #endif
        return;
    }
so on OS X we were using the default normal/fast mutexes. OS X does have
PTHREAD_MUTEX_ERRORCHECK (and validate passes if we use it, apart from
hpc_ghc_ghci working on OS X), but I don't know what other OSes use, or
if they have no equivalent.

So what's the best way forward? Use PTHREAD_MUTEX_ERRORCHECK for
non-Linux platforms, and see if anyone reports build failures? Then we
can fix any reported failures, either by setting the appropriate type
for that OS, or by not defining ASSERT_LOCK_HELD on that platform if
none exists.


Thanks
Ian

_______________________________________________
Cvs-ghc mailing list
Cvs-ghc@haskell.org
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to