summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu/src/gg_proto.h
diff options
context:
space:
mode:
authorSzymon Tokarz <wsx22@o2.pl>2012-11-03 00:42:26 +0000
committerSzymon Tokarz <wsx22@o2.pl>2012-11-03 00:42:26 +0000
commitb6c5e03eb8c6e746ec4b1f28c472c93305986bbf (patch)
tree7007abe8c39ee405d6fd9cc1f23287fc836eaaec /protocols/Gadu-Gadu/src/gg_proto.h
parent3a0bfdecae261d7a33c2114ec47dda0eaafe6572 (diff)
GaduGadu-Gadu protocol
- more info logged to netlog at debug version. schould help track multithread issues - netlog logging messages fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@2157 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Gadu-Gadu/src/gg_proto.h')
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index 8765392328..615fea1976 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -111,6 +111,10 @@ struct GGPROTO : public PROTO_INTERFACE, public MZeroedObject
HANDLE forkthreadex(GGThreadFunc pFunc, void *param, UINT *threadId);
void threadwait(GGTHREAD *thread);
+ void gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, char* mutexName, int logging);
+ void gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, int returnNumber, char* mutexName, int logging);
+ void gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int sleepNumber, int logging);
+
/* Global GG functions */
void notifyuser(HANDLE hContact, int refresh);
void setalloffline();
@@ -292,4 +296,36 @@ typedef struct
GGPROTO *gg;
} GGUSERUTILDLGDATA;
+
+inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, char* mutexName, int logging)
+{
+#ifdef DEBUGMODE
+ int logAfter = 0;
+ if(logging == 1 && mutex->LockCount != -1) {
+ logAfter = 1;
+ netlog("%s(): %i before EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
+ }
+#endif
+ EnterCriticalSection(mutex);
+#ifdef DEBUGMODE
+ if(logging == 1 && logAfter == 1) netlog("%s(): %i after EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
+#endif
+}
+
+inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, int returnNumber, char* mutexName, int logging) /*0-never, 1-debug, 2-all*/
+{
+#ifdef DEBUGMODE
+ if(logging == 1) netlog("%s(): %i.%i LeaveCriticalSection %s", callingFunction, sectionNumber, returnNumber, mutexName);
+#endif
+ LeaveCriticalSection(mutex);
+}
+
+inline void GGPROTO::gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int sleepNumber, int logging){
+ SleepEx(miliseconds, alterable);
+#ifdef DEBUGMODE
+ if(logging == 1) netlog("%s(): %i after SleepEx(%ld,%u)", callingFunction, sleepNumber, miliseconds, alterable);
+#endif
+}
+
+
#endif