/* Support for concurrent library updates via
multithreaded background processes */
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
static pthread_t Thread_id_cpus;
static sem_t Semaphore_cpus_beg, Semaphore_cpus_end;
#endif
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
static pthread_t Thread_id_memory;
static sem_t Semaphore_memory_beg, Semaphore_memory_end;
#endif
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
static pthread_t Thread_id_tasks;
static sem_t Semaphore_tasks_beg, Semaphore_tasks_end;
#endif
// there's lots of signal-unsafe stuff in the following ...
if (Frames_signal != BREAK_sig) {
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
pthread_cancel(Thread_id_cpus);
pthread_join(Thread_id_cpus, NULL);
sem_destroy(&Semaphore_cpus_beg);
sem_destroy(&Semaphore_cpus_end);
#endif
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
pthread_cancel(Thread_id_memory);
pthread_join(Thread_id_memory, NULL);
sem_destroy(&Semaphore_memory_beg);
sem_destroy(&Semaphore_memory_end);
#endif
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
pthread_cancel(Thread_id_tasks);
pthread_join(Thread_id_tasks, NULL);
sem_destroy(&Semaphore_tasks_end);
enum stat_reap_type which;
do {
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
sem_wait(&Semaphore_cpus_beg);
#endif
which = STAT_REAP_CPUS_ONLY;
Cpu_cnt = 48;
#endif
}
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
sem_post(&Semaphore_cpus_end);
} while (1);
#else
time_t cur_secs;
do {
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
sem_wait(&Semaphore_memory_beg);
#endif
if (Frames_signal)
error_exit(fmtmk(N_fmt(LIB_errormem_fmt),__LINE__, strerror(errno)));
sav_secs = cur_secs;
}
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
sem_post(&Semaphore_memory_end);
} while (1);
#else
int i, what;
do {
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
sem_wait(&Semaphore_tasks_beg);
#endif
procps_uptime(&uptime_cur, NULL);
for (i = 0; i < GROUPSMAX; i++)
memcpy(Winstk[i].ppt, Pids_reap->stacks, sizeof(void *) * PIDSmaxt);
}
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
sem_post(&Semaphore_tasks_end);
} while (1);
#else
sigfillset(&sa.sa_mask);
pthread_sigmask(SIG_BLOCK, &sa.sa_mask, NULL);
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
if (0 != sem_init(&Semaphore_cpus_beg, 0, 0)
|| (0 != sem_init(&Semaphore_cpus_end, 0, 0)))
error_exit(fmtmk(N_fmt(X_SEMAPHORES_fmt),__LINE__, strerror(errno)));
error_exit(fmtmk(N_fmt(X_THREADINGS_fmt),__LINE__, strerror(errno)));
pthread_setname_np(Thread_id_cpus, "update cpus");
#endif
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
if (0 != sem_init(&Semaphore_memory_beg, 0, 0)
|| (0 != sem_init(&Semaphore_memory_end, 0, 0)))
error_exit(fmtmk(N_fmt(X_SEMAPHORES_fmt),__LINE__, strerror(errno)));
error_exit(fmtmk(N_fmt(X_THREADINGS_fmt),__LINE__, strerror(errno)));
pthread_setname_np(Thread_id_memory, "update memory");
#endif
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
if (0 != sem_init(&Semaphore_tasks_beg, 0, 0)
|| (0 != sem_init(&Semaphore_tasks_end, 0, 0)))
error_exit(fmtmk(N_fmt(X_SEMAPHORES_fmt),__LINE__, strerror(errno)));
// whoa either first time or thread/task mode change, (re)prime the pump...
if (Pseudo_row == PROC_XTRA) {
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
sem_post(&Semaphore_tasks_beg);
sem_wait(&Semaphore_tasks_end);
#else
} else
putp(Batch ? "\n\n" : Cap_home);
-#ifndef THREADNO_TSK
+#ifdef THREADED_TSK
sem_post(&Semaphore_tasks_beg);
#else
tasks_refresh(NULL);
#endif
-#ifndef THREADNO_CPU
+#ifdef THREADED_CPU
sem_post(&Semaphore_cpus_beg);
#else
cpus_refresh(NULL);
#endif
-#ifndef THREADNO_MEM
+#ifdef THREADED_MEM
sem_post(&Semaphore_memory_beg);
#else
memory_refresh(NULL);
//#define SCROLLV_BY_1 /* when scrolling left/right do not move 8 */
//#define STRINGCASENO /* case insenstive compare/locate versions */
//#define TERMIOS_ONLY /* use native input only (just limp along) */
-//#define THREADNO_CPU /* suppress background thread for cpu updt */
-//#define THREADNO_MEM /* suppress background thread for mem updt */
-//#define THREADNO_TSK /* suppress background thread for tsk updt */
+//#define THREADED_CPU /* separate background thread for cpu updt */
+//#define THREADED_MEM /* separate background thread for mem updt */
+//#define THREADED_TSK /* separate background thread for tsk updt */
//#define TOG4_NOFORCE /* no force 2 abreast mode with '4' toggle */
//#define TOG4_NOTRUNC /* ensure no truncation for 2 abreast mode */
//#define TOG4_OFF_MEM /* don't show two abreast memory statistic */