#define MYCURSORS (((ThreadTSD*)pthread_getspecific(ThreadKey))->cursors)
#define MYTID (((ThreadTSD*)pthread_getspecific(ThreadKey))->tid)
#define CT (((ThreadTSD*)pthread_getspecific(ThreadKey))->self)
+#define CTP ((ThreadTSD*)pthread_getspecific(ThreadKey))
/** return the current context list as an array and do it in a safe manner
* The returned data is a copy so only reading is useful
time_t unixtime;
StrBuf *lBuf;
CitContext *CCC = CC;
-
+ ThreadTSD *cTSD = CTP;
+ CtdlThreadNode *node = NULL;
+ long lwpid = 0;
+
+ if (cTSD != NULL)
+ node = cTSD->self;
+ if ((node != NULL) && (node->reltid != 0))
+ {
+ lwpid = node->pid + node->reltid;
+ }
+
gettimeofday(&tv, NULL);
/* Promote to time_t; types differ on some OSes (like darwin) */
unixtime = tv.tv_sec;
tim.tm_year + 1900, tim.tm_mon + 1,
tim.tm_mday, tim.tm_hour, tim.tm_min,
tim.tm_sec, (long)tv.tv_usec);
+
+
+ if (lwpid != 0)
+ StrBufAppendPrintf(lBuf,
+ "[LWP:%d] ",
+ lwpid);
if (CCC != NULL) {
if (CCC->cs_pid != 0)
* remove the need for the calls to eCrashRegisterThread and friends
*/
+static int next_tid = 3; /* offset LWPID to PID */
static int num_threads = 0; /* Current number of threads */
static int num_workers = 0; /* Current number of worker threads */
long statcount = 0; /* are we doing a stats check? */
free(this_thread);
return NULL;
}
-
+ this_thread->reltid = next_tid;
+ next_tid++;
num_threads++; // Increase the count of threads in the system.
if(this_thread->flags & CTDLTHREAD_WORKER)
num_workers++;
struct CtdlThreadNode{
citthread_t tid; /* id as returned by citthread_create() */
pid_t pid; /* pid, as best the OS will let us determine */
+ long reltid; /* counting from start... */
time_t when; /* When to start a scheduled thread */
struct CitContext *Context; /* The session context that this thread mught be working on or NULL if none */
long number; /* A unigue number for this thread (not implimented yet) */