ecere/sys/GetCurrentThredID(): Changed to return a 64 bit type
authorJerome St-Louis <jerome@ecere.com>
Sun, 10 Mar 2013 04:59:20 +0000 (23:59 -0500)
committerJerome St-Louis <jerome@ecere.com>
Sun, 10 Mar 2013 04:59:20 +0000 (23:59 -0500)
- pthread_t is a pointer on FreeBSD

ecere/src/gui/GuiApplication.ec
ecere/src/net/dcom.ec
ecere/src/net/network.ec
ecere/src/sys/FileMonitor.ec
ecere/src/sys/Mutex.ec

index f41d366..6e85baf 100644 (file)
@@ -187,7 +187,7 @@ public class GuiApplication : Application
    Size virtualScreen;   
    Point virtualScreenPos;
 
-   int mainThread;
+   int64 mainThread;
 
    GuiApplication()
    {
@@ -1287,7 +1287,7 @@ public:
       
       // Reentrant FileNotification is asking for trouble since each monitor is spawning a Modal() MessageBox
       if(reentrant) return false;
-      // printf("[%d] Waiting in ProcessFileNotifications for fileMonitor Mutex %x...\n", GetCurrentThreadID(), globalSystem.fileMonitorMutex);
+      // printf("[%d] Waiting in ProcessFileNotifications for fileMonitor Mutex %x...\n", (int)GetCurrentThreadID(), globalSystem.fileMonitorMutex);
       globalSystem.fileMonitorMutex.Wait();
       reentrant++;
       for(monitor = globalSystem.fileMonitors.first; monitor; monitor = next)
@@ -1343,7 +1343,7 @@ public:
                monitor.FreeMonitor();
          }
       }
-      // printf("[%d] Releasing in ProcessFileNotifications fileMonitor Mutex %x...\n", GetCurrentThreadID(), globalSystem.fileMonitorMutex);
+      // printf("[%d] Releasing in ProcessFileNotifications fileMonitor Mutex %x...\n", (int)GetCurrentThreadID(), globalSystem.fileMonitorMutex);
       globalSystem.fileMonitorMutex.Release();
       return activity;
    }
index 7e48b3a..f2681ba 100644 (file)
@@ -150,7 +150,7 @@ public:
 
       if(serverSocket && serverSocket.connected)
       {
-         int currentThreadID = GetCurrentThreadID();
+         int64 currentThreadID = GetCurrentThreadID();
          int callID = nextCallID++;
          DCOMServerSocket socket = serverSocket;
          DCOMServerSocket processingSocket;
index d8ab92f..2cb1354 100644 (file)
@@ -65,7 +65,7 @@ private struct NetworkData
    bool leftOverBytes;
    Mutex processMutex;
    Mutex mutex;
-   int mainThreadID;
+   int64 mainThreadID;
    OldList mtSemaphores;
 };
 
index d1363ae..b6f1fb0 100644 (file)
@@ -303,7 +303,7 @@ static class MonitorThread : Thread
             bool fileActivity = false;
             lastTime = currentTime;
 
-            // printf("[%d] Waiting in MonitorThread for fileMonitor Mutex %x...\n", GetCurrentThreadID(), globalSystem.fileMonitorMutex);
+            // printf("[%d] Waiting in MonitorThread for fileMonitor Mutex %x...\n", (int)GetCurrentThreadID(), globalSystem.fileMonitorMutex);
             globalSystem.fileMonitorMutex.Wait();
 
             for(monitor = globalSystem.fileMonitors.first; monitor; monitor = monitor.next)
@@ -417,15 +417,15 @@ static class MonitorThread : Thread
             }
             if(fileActivity)
             {
-               // printf("[%d] Signaling Event...\n", GetCurrentThreadID());
+               // printf("[%d] Signaling Event...\n", (int)GetCurrentThreadID());
                guiApp.SignalEvent();
             }
 
-            // printf("[%d] Releasing Mutex...\n", GetCurrentThreadID());
+            // printf("[%d] Releasing Mutex...\n", (int)GetCurrentThreadID());
             globalSystem.fileMonitorMutex.Release();
          }
          
-         // printf("[%d] Sleeping...\n", GetCurrentThreadID());
+         // printf("[%d] Sleeping...\n", (int)GetCurrentThreadID());
          Sleep(1.0 / 18.2);
       }
       return 0;
index 24c5dab..1d86e26 100644 (file)
@@ -27,12 +27,12 @@ namespace sys;
 import "instance"
 
 // Moved this here from Thread.ec to make compiling ecereCOM in Debug easier
-public int GetCurrentThreadID()
+public int64 GetCurrentThreadID()
 {
 #if defined(__WIN32__)
-   return (int)GetCurrentThreadId();
+   return (int64)GetCurrentThreadId();
 #else
-   return (int)pthread_self();
+   return (int64)pthread_self();
 #endif
 }
 
@@ -50,7 +50,7 @@ public class Mutex : struct
 #endif
 
 #ifdef _DEBUG
-   int owningThread;
+   int64 owningThread;
 #endif
    int lockCount;
 
@@ -103,7 +103,7 @@ public:
       {
          /*
          if(this == globalSystem.fileMonitorMutex)
-            printf("[%d] Waiting on Mutex %x\n", GetCurrentThreadID(), this);
+            printf("[%d] Waiting on Mutex %x\n", (int)GetCurrentThreadID(), this);
          */
 #if defined(__WIN32__)
 #ifdef _DEBUG
@@ -138,7 +138,7 @@ public:
       {
          /*
          if(this == globalSystem.fileMonitorMutex)
-            printf("[%d] Releasing Mutex %x\n", GetCurrentThreadID(), this);
+            printf("[%d] Releasing Mutex %x\n", (int)GetCurrentThreadID(), this);
          */
 #ifdef _DEBUG
          if(lockCount && owningThread != GetCurrentThreadID())