From 99eb7900276d2ee629081251e4412644eef55bf0 Mon Sep 17 00:00:00 2001 From: Michael Ploujnikov Date: Thu, 26 Nov 2009 11:21:31 -0500 Subject: [PATCH] rename LUMIERA_THREAD_* to LUMIERA_THREADCLASS_* in enum lumiera_thread_class --- src/backend/thread-wrapper.hpp | 4 ++-- src/backend/threads.h | 13 ++++++------- tests/backend/test-threadpool.c | 8 ++++---- tests/backend/test-threads.c | 6 +++--- 4 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/backend/thread-wrapper.hpp b/src/backend/thread-wrapper.hpp index 730b4338b..3f897b582 100644 --- a/src/backend/thread-wrapper.hpp +++ b/src/backend/thread-wrapper.hpp @@ -207,7 +207,7 @@ namespace backend { : started_(false), operation_(operation) { - start_thread (LUMIERA_THREAD_INTERACTIVE, purpose, logging_flag); + start_thread (LUMIERA_THREADCLASS_INTERACTIVE, purpose, logging_flag); } /** Variant of the standard case, used to register a JoinHandle in addition to starting a thread. @@ -220,7 +220,7 @@ namespace backend { : started_(false), operation_(operation) { - start_thread (LUMIERA_THREAD_INTERACTIVE, purpose, logging_flag, + start_thread (LUMIERA_THREADCLASS_INTERACTIVE, purpose, logging_flag, join.accessLockedCondition()); } }; diff --git a/src/backend/threads.h b/src/backend/threads.h index 51000782a..3a45bc5e5 100644 --- a/src/backend/threads.h +++ b/src/backend/threads.h @@ -51,20 +51,19 @@ typedef lumiera_thread* LumieraThread; * Thread classes. * We define some 'classes' of threads for different purposes to abstract * priorities and other attributes. - ** TODO: rename these to LUMIERA_THREADCLASS_* */ enum lumiera_thread_class { /** mostly idle, low latency **/ - LUMIERA_THREAD_INTERACTIVE, + LUMIERA_THREADCLASS_INTERACTIVE, /** busy at average priority **/ - LUMIERA_THREAD_WORKER, + LUMIERA_THREADCLASS_WORKER, /** busy, soft realtime, high priority **/ - LUMIERA_THREAD_URGENT, + LUMIERA_THREADCLASS_URGENT, /** high latency, background jobs **/ - LUMIERA_THREAD_BATCH, + LUMIERA_THREADCLASS_BATCH, /** Something to do when there is really nothing else to do **/ - LUMIERA_THREAD_IDLE, + LUMIERA_THREADCLASS_IDLE, /** this just denotes the number of classes listed above, it is used to create arrays **/ LUMIERA_THREADCLASS_COUNT, @@ -99,7 +98,7 @@ typedef enum */ struct lumiera_thread_struct { - llist node; + llist node; // this should be first for easy casting // the function and argument can be passed to the thread at creation time // void (*function)(void*); // void* arg; diff --git a/tests/backend/test-threadpool.c b/tests/backend/test-threadpool.c index 530fc10de..66de5c1a3 100644 --- a/tests/backend/test-threadpool.c +++ b/tests/backend/test-threadpool.c @@ -35,21 +35,21 @@ TEST ("basic-acquire-release") lumiera_threadpool_init(100); ECHO("acquiring thread 1"); LumieraThread t1 = - lumiera_threadpool_acquire_thread(LUMIERA_THREAD_INTERACTIVE, + lumiera_threadpool_acquire_thread(LUMIERA_THREADCLASS_INTERACTIVE, "test purpose", NULL); ECHO("acquiring thread 2"); LumieraThread t2 = - lumiera_threadpool_acquire_thread(LUMIERA_THREAD_IDLE, + lumiera_threadpool_acquire_thread(LUMIERA_THREADCLASS_IDLE, "test purpose", NULL); //ECHO("thread 1 kind=%d", t1->kind); - CHECK(LUMIERA_THREAD_INTERACTIVE == t1->kind); + CHECK(LUMIERA_THREADCLASS_INTERACTIVE == t1->kind); //ECHO("thread 1 state=%d", t1->state); CHECK(LUMIERA_THREADSTATE_IDLE == t1->state); //ECHO("thread 2 kind=%d", t2->kind); - CHECK(LUMIERA_THREAD_IDLE == t2->kind); + CHECK(LUMIERA_THREADCLASS_IDLE == t2->kind); //ECHO("thread 2 state=%d", t2->state); CHECK(LUMIERA_THREADSTATE_IDLE == t2->state); diff --git a/tests/backend/test-threads.c b/tests/backend/test-threads.c index 14237f7a2..76da2f450 100644 --- a/tests/backend/test-threads.c +++ b/tests/backend/test-threads.c @@ -88,7 +88,7 @@ TEST ("simple_thread") { fprintf (stderr, "main before thread %s\n", NOBUG_THREAD_ID_GET); - lumiera_thread_run (LUMIERA_THREAD_WORKER, + lumiera_thread_run (LUMIERA_THREADCLASS_WORKER, threadfn, NULL, NULL, @@ -109,7 +109,7 @@ TEST ("thread_synced") { ECHO ("main before thread %s", NOBUG_THREAD_ID_GET); - lumiera_thread_run (LUMIERA_THREAD_WORKER, + lumiera_thread_run (LUMIERA_THREADCLASS_WORKER, threadsyncfn, &cnd, &cnd, @@ -140,7 +140,7 @@ TEST ("mutex_thread") { fprintf (stderr, "main before thread %s\n", NOBUG_THREAD_ID_GET); - lumiera_thread_run (LUMIERA_THREAD_WORKER, + lumiera_thread_run (LUMIERA_THREADCLASS_WORKER, mutexfn, NULL, NULL,