Changeset 7787


Ignore:
Timestamp:
02/13/19 01:38:14 (6 months ago)
Author:
alexander
Message:

Adding some cleanup for threading issues on Linux

Location:
trunk/src
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/archiving/nq2wws/externs.h

    r4369 r7787  
    4343EXTERN time_t   TSLastBeat;             /* time stamp since last heartbeat */ 
    4444EXTERN time_t   timeNow;                /* time stamp since last heartbeat */ 
    45 EXTERN unsigned TidHB;                  /* ID for the hearbeat thread */ 
     45EXTERN ew_thread_t TidHB;                       /* ID for the hearbeat thread */ 
    4646/****************************************************************/ 
  • trunk/src/data_exchange/coaxtoring/coaxtoring.c

    r7497 r7787  
    169169   int      res; 
    170170   unsigned stackSize;           /* Stack size of heartbeat and MsgIn threads */ 
    171    unsigned tidHeart;            /* Thread id of the heartbeat thread */ 
    172    unsigned tidMsgIn;            /* Thread id of the MsgIn thread */ 
    173    unsigned tidKill;             /* Thread id of the KillProcess thread */ 
     171   ew_thread_t tidHeart;            /* Thread id of the heartbeat thread */ 
     172   ew_thread_t tidMsgIn;            /* Thread id of the MsgIn thread */ 
     173   ew_thread_t tidKill;             /* Thread id of the KillProcess thread */ 
    174174 
    175175/* Initialize name of log-file & open it 
  • trunk/src/data_exchange/ew2ringserver/ew2ringserver.c

    r7727 r7787  
    7575/* Thread things */ 
    7676#define THREAD_STACK 8192 
    77 static unsigned tidStacker;          /* Thread moving messages from transport to queue */ 
     77static ew_thread_t tidStacker;          /* Thread moving messages from transport to queue */ 
    7878 
    7979#define MSGSTK_OFF    0              /* MessageStacker has not been started      */ 
  • trunk/src/data_exchange/ewexport2ringserver/src/ewexport2ringserver.c

    r7775 r7787  
    113113volatile int Sd;                     /* Socket descriptor                                */ 
    114114char     *MsgBuf;                    /* incoming message buffer; used by receiver thread */ 
    115 ew_thread_t TidMsgRcv = 0;             /* thread id. was type thread_t on Solaris!         */ 
     115ew_thread_t TidMsgRcv;             /* thread id. was type thread_t on Solaris!         */ 
    116116 
    117117MSG_LOGO      heartlogo; 
     
    12451245static void term_handler ( int sig ) 
    12461246{ 
    1247   if ( TidMsgRcv ) 
    1248     ThreadKill (TidMsgRcv); 
     1247  ThreadKill (TidMsgRcv); 
    12491248   
    12501249  if ( Sd ) 
  • trunk/src/data_exchange/liss2ew_scnl/liss2ew_scnl.cpp

    r7606 r7787  
    476476                } 
    477477 
    478                 ConnInfo[i].thread_id = 0; 
    479478                ConnInfo[i].thread_index = -1; 
    480479                ConnInfo[i].pSocket = NULL; 
  • trunk/src/data_sources/k2ew/heartbt.c

    r7775 r7787  
    4747       output thread hasn't started or it's working, then... */ 
    4848    if ( (difftime(timevar,last_hb_time) >= (double)gcfg_heartbeat_itvl) && 
    49          (g_mt_working == 1) &&  
    50          (g_output_threadid == (ew_thread_t) -1 || g_ot_working == 1)) 
     49         (g_mt_working == 1) &&  g_ot_working == 1) 
    5150    {   
    5251      /* Beat our heart */       
  • trunk/src/data_sources/k2ew/k2ewmain.c

    r7775 r7787  
    385385volatile int g_mt_working = 1;    /* =1 says main thread is working */ 
    386386volatile int g_ot_working = 0;    /* =1 says output thread is working */ 
    387 ew_thread_t g_output_threadid=(ew_thread_t)-1;    /* ID for output thread */ 
    388 ew_thread_t g_hrtbt_threadid=(ew_thread_t)-1;     /* ID for heartbeat thread */ 
     387ew_thread_t g_output_threadid;    /* ID for output thread */ 
     388ew_thread_t g_hrtbt_threadid;     /* ID for heartbeat thread */ 
    389389pid_t g_pidval = 0;                 /* Our PID for heartbeat messages */ 
    390390int g_wait_count = 0;             /* number of "wait" blocks in buffer */ 
  • trunk/src/data_sources/k2ew/terminat.c

    r7775 r7787  
    9191  {      /* no other thread using function */ 
    9292    infn_flg = 1;              /* indicate now in function */ 
    93     if (g_output_threadid != (ew_thread_t)-1)    /* if read thread running then */ 
    94       KillThread(g_output_threadid);         /* terminate read thread */ 
     93    KillThread(g_output_threadid);         /* terminate read thread */ 
    9594 
    9695    if (k2term_code < 0 || k2term_code > K2TERM_NUMENTS) 
  • trunk/src/data_sources/nq2ring/externs.h

    r4356 r7787  
    4848EXTERN time_t   TSLastBeat;             /* time stamp since last heartbeat */ 
    4949EXTERN time_t   timeNow;                /* time stamp since last heartbeat */ 
    50 EXTERN unsigned TidHB;                  /* ID for the hearbeat thread */ 
     50EXTERN ew_thread_t TidHB;                       /* ID for the hearbeat thread */ 
    5151/****************************************************************/ 
  • trunk/src/libsrc/unix/threads_ew.c

    r7775 r7787  
    103103        } 
    104104 
    105    *thread_id = (ew_thread_t) tid; 
    106  
    107    if ( *thread_id != tid )             /* Critical on 64-bit systems */ 
    108    logit( "ep", "StartThread: " 
     105   *thread_id = (pthread_t) tid; 
     106 
     107   if ( pthread_equal(*thread_id, tid) == 0 )           /* Critical on 64-bit systems */ 
     108      logit( "ep", "StartThread: " 
    109109                "Warning: thread ID overflows thread_id data type.\n"); 
    110110 
     
    182182        } 
    183183 
    184    *thread_id = (ew_thread_t) tid; 
    185  
    186    if ( *thread_id != tid )             /* Critical on 64-bit systems */ 
    187    logit( "ep", "StartThreadWithArg: " 
    188                 "Warning: thread ID overflows thread_id data type.\n"); 
     184   *thread_id = (pthread_t)tid; 
     185 
     186   if ( pthread_equal(*thread_id, tid) == 0 )           /* Critical on 64-bit systems */ 
     187      logit( "ep", "StartThreadWithArg: " 
     188                   "Warning: thread ID overflows thread_id data type.\n"); 
    189189 
    190190   return 0; 
  • trunk/src/reporting/nq2gif/externs.h

    r4383 r7787  
    4848EXTERN time_t   TSLastBeat;             /* time stamp since last heartbeat */ 
    4949EXTERN time_t   timeNow;                /* time stamp since last heartbeat */ 
    50 EXTERN unsigned TidHB;                  /* ID for the hearbeat thread */ 
     50EXTERN ew_thread_t TidHB;                       /* ID for the hearbeat thread */ 
    5151/****************************************************************/ 
  • trunk/src/seismic_processing/ew2rsam/ew2rsam.c

    r7272 r7787  
    107107/* Thread stuff */ 
    108108#define THREAD_STACK 8192 
    109 static unsigned tidProcessor;    /* Processor thread id */ 
    110 static unsigned tidStacker;      /* Thread moving messages from InRing */ 
     109static ew_thread_t tidProcessor;    /* Processor thread id */ 
     110static ew_thread_t tidStacker;      /* Thread moving messages from InRing */ 
    111111                                 /* to MsgQueue */ 
    112112int MessageStackerStatus = 0;      /* 0=> Stacker thread ok. <0 => dead */ 
Note: See TracChangeset for help on using the changeset viewer.