1 /***************************************************************************
2 * Copyright (C) 2007 by www.databasecache.com *
3 * Contact: praba_tuty@databasecache.com *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 ***************************************************************************/
22 #include<Transaction.h>
39 ThreadTrans() { pid_
=0; thrid_
=0; trans_
= NULL
; }
40 void init() { pid_
=0; thrid_
=0; trans_
= NULL
; }
53 ThreadTrans thrTrans_
[MAX_THREADS_PER_PROCESS
]; //list of thread specific transactions
55 Mutex
*want_
; //single mutex which we are waiting for.
57 Mutex
*has_
[MAX_MUTEX_PER_THREAD
]; //list of mutexes held
69 static caddr_t sysAddr
;
70 static caddr_t usrAddr
;
71 static Database
*systemDatabase
;
72 static List hasLockList
;
74 //ThreadInfo *thrInfo;
76 DbRetVal
registerThread();
77 DbRetVal
deregisterThread(int slot
);
78 static DbRetVal
addMutex(Mutex
*mutex
, int pslot
);
79 static DbRetVal
removeMutex(Mutex
*mutex
, int pslot
);
81 static DbRetVal
setThreadTransaction(Transaction
*trans
, int pslot
);
82 static Transaction
* getThreadTransaction(int pslot
);
83 static Transaction
** getThreadTransAddr(int pslot
);
85 void printUsageStatistics();
86 void printDebugInfo();
88 int getProcSlot() { return procSlot
; }
89 bool isAnyOneRegistered();