#include <pthread.h>
#include "dldet.h"

void *thread_function(void *arg)
{
    pthread_mutex_t   mutexes[16];
    int               itmp, pret;

    
    printf("\nThread main!");

    // Set up sixteen mutexes
    for(itmp = 0; itmp < 16; itmp++)
	pthread_mutex_init(&mutexes[itmp], NULL);
	

    // Lock them all
    printf("\Locking mutexes");
    for(itmp = 0; itmp < 16; itmp++)
	dld_pthread_mutex_lock(&mutexes[itmp]);

    printf("\nUnlocking mutexes");
    for(itmp = 0; itmp < 16; itmp++)
	dld_pthread_mutex_unlock(&mutexes[itmp]);

    // Now generate a deadlock, lock one twice
    printf("\nLock 0 first time: %d",
	   dld_pthread_mutex_lock(&mutexes[0]));
	   
    printf("\nLock 0 second time: %d",
	   dld_pthread_mutex_lock(&mutexes[0]));

    // Bail for now
    return(NULL);
}

int main(int argc, char *argv[])
{
    pthread_t    threads[2];
    int          pret, itmp;

    pret = dld_pthread_create(&threads[0], NULL, 

