Fossil

Check-in [4695f217]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the code for obtaining process ids on windows.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | backoffice
Files: files | file ages | folders
SHA3-256: 4695f217ce5e1bd7df1b5947331bc12fbb25dc8226062131f670211d96c3d24d
User & Date: drh 2018-07-18 16:54:28
Context
2018-07-18
16:58
Add the concept of "backoffice" processing, used to do background cleanup operations after repository changes, such sending alerts and/or syncing to peer repositories. check-in: 947081aa user: drh tags: trunk
16:54
Fix the code for obtaining process ids on windows. Closed-Leaf check-in: 4695f217 user: drh tags: backoffice
16:43
Add the backoffice module for doing post-processing actions such as sending alerts and/or syncing repositories. check-in: 86b43a46 user: drh tags: backoffice
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/backoffice.c.

    37     37   ** process table, doing nothing on rarely accessed repositories, and
    38     38   ** if the Fossil binary is updated on a system, the backoffice processes
    39     39   ** will restart using the new binary automatically.
    40     40   */
    41     41   #include "config.h"
    42     42   #include "backoffice.h"
    43     43   #include <time.h>
    44         -#if !defined(_WIN32)
           44  +#if defined(_WIN32)
           45  +# include <windows.h>
           46  +#else
    45     47   # include <sys/types.h>
    46     48   # include <signal.h>
    47     49   #endif
    48     50   
    49     51   /*
    50     52   ** The BKOFCE_LEASE_TIME is the amount of time for which a single backoffice
    51     53   ** processing run is valid.  Each backoffice run monopolizes the lease for
................................................................................
   139    141   }
   140    142   
   141    143   /*
   142    144   ** Return a process id number for the current process
   143    145   */
   144    146   static sqlite3_uint64 backofficeProcessId(void){
   145    147   #if defined(_WIN32)
   146         -  ULONG Id = 0;
   147         -  GetCurrentProcessId(&Id);
   148         -  return Id;
          148  +  return (sqlite3_uint64)GetCurrentProcessId();
   149    149   #else
   150         -  return getpid();
          150  +  return (sqlite3_uint64)getpid();
   151    151   #endif
   152    152   }
   153    153   
   154    154   /*
   155    155   ** COMMAND: test-process-id
   156    156   **
   157    157   ** Usage: %fossil [--sleep N] PROCESS-ID ...