/*************************************************************************** ltypes.h - description ------------------- begin : Thu Nov 8 2001 copyright : (C) 2001 by Matt Sabins email : sabinsmh@clarkson.edu ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef _LTYPES_H_ #define _LTYPES_H_ //types for easy change. #include //for pthread_t void locksmith_bail(); //A little just in case function typedef unsigned int memaddr_t; typedef unsigned int code_loc_t; typedef enum { false = 0, true = 1 } bool; typedef enum { L_STATIC_WRITE, //A write to a static named data variable L_STATIC_READ, //A read from a static named data variable L_DYNAMIC_WRITE, //A write to a pointered to variable. L_DYNAMIC_READ, //A read from a pointed variable. }line_type_e; typedef enum { LS_EXCLUSIVE, LS_SHARED, LS_SHRD_MOD }lock_state_e; //this is the linked list keeping track of the locks acquired by the thread. typedef struct lock_node_s { pthread_mutex_t* mutex; //I have to store the pointer to //because mutexes don't have //identifiers. time_t timestamp; //the last time aqcuired. struct lock_node_s* next; //next } lock_node_t; //Since at different stages of computation code locations can have different //sets of locks held typedef struct lock_set_s{ lock_node_t* read_held; // lock_node_t* write_held; For Read-Write Locks not implemented. bool all_locks; line_type_e access_type; lock_state_e state; pthread_t excl_thread; }lock_set_t; typedef struct { memaddr_t addr; lock_set_t * data; bool isfull; }smith_node_t; typedef struct { pthread_t thread_id; lock_node_t* locks; //acquired lock list at this time. bool is_full; //node contains a thread id. } pthread_id_node_t; #endif