add a threads/threadpool NOBUG flag hierarchy

and remove redundant/errorneous flag initializations as a result
also use the test flag from logging.h
This commit is contained in:
Michael Ploujnikov 2010-01-31 20:28:25 -05:00
parent c57c02ea45
commit b799321dff
5 changed files with 15 additions and 15 deletions

View file

@ -37,7 +37,6 @@ static lumiera_threadpool threadpool;
* @file
*
*/
NOBUG_DEFINE_FLAG_PARENT (threadpool, threads_dbg); /*TODO insert a suitable/better parent flag here */
LUMIERA_ERROR_DEFINE(THREADPOOL_OFFLINE, "tried to acquire thread while threadpool is not available");
@ -46,10 +45,7 @@ LUMIERA_ERROR_DEFINE(THREADPOOL_OFFLINE, "tried to acquire thread while threadpo
void
lumiera_threadpool_init(void)
{
NOBUG_INIT_FLAG (threadpool);
NOBUG_INIT_FLAG (threads);
TRACE (threadpool);
NOBUG_INIT_FLAG (threads);
for (int i = 0; i < LUMIERA_THREADCLASS_COUNT; ++i)
{

View file

@ -41,7 +41,6 @@
*
*/
NOBUG_DEFINE_FLAG_PARENT (threads, threads_dbg); /*TODO insert a suitable/better parent flag here */
//code goes here//

View file

@ -34,7 +34,6 @@
//TODO: System includes//
#include <nobug.h>
NOBUG_DECLARE_FLAG (threads);
/**

View file

@ -82,7 +82,10 @@ NOBUG_CPP_DEFINE_FLAG_PARENT ( filedescriptor_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( mmap_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( mmapcache_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( mmapings_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( threads_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( thread_dbg, backend_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( threads_dbg, thread_dbg);
NOBUG_CPP_DEFINE_FLAG_PARENT ( threadpool_dbg, thread_dbg);
/** base of debug logging for the proc layer */
NOBUG_CPP_DEFINE_FLAG_PARENT ( proc_dbg, debugging);
NOBUG_CPP_DEFINE_FLAG_PARENT ( command_dbg, proc_dbg);
@ -119,6 +122,8 @@ NOBUG_CPP_DEFINE_FLAG_PARENT ( backend, progress);
NOBUG_CPP_DEFINE_FLAG_PARENT ( file, backend); //opening/closing files etc
NOBUG_CPP_DEFINE_FLAG_PARENT ( mmap, backend); //mmap errors
NOBUG_CPP_DEFINE_FLAG_PARENT ( thread, backend); //starting/stopping threads
NOBUG_CPP_DEFINE_FLAG_PARENT ( threads, thread);
NOBUG_CPP_DEFINE_FLAG_PARENT ( threadpool, thread);
/** progress log for the proc layer */
NOBUG_CPP_DEFINE_FLAG_PARENT ( proc, progress);
/** progress log for proc-layer command dispatch */

View file

@ -22,6 +22,7 @@
#include "tests/test.h"
#include "backend/threadpool.h"
#include "include/logging.h"
#include <stdio.h>
#include <string.h>
@ -68,7 +69,7 @@ TEST ("threadpool1")
LumieraThread t1 =
lumiera_threadpool_acquire_thread(LUMIERA_THREADCLASS_INTERACTIVE,
"test purpose",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
// lumiera_threadpool_release_thread(t1);
ECHO("acquired thread 1 %p",t1);
lumiera_threadpool_destroy();
@ -84,13 +85,13 @@ TEST ("two-thread-acquire")
LumieraThread t1 =
lumiera_threadpool_acquire_thread(LUMIERA_THREADCLASS_INTERACTIVE,
"test purpose",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
ECHO("acquiring thread 2");
LumieraThread t2 =
lumiera_threadpool_acquire_thread(LUMIERA_THREADCLASS_IDLE,
"test purpose",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
ECHO("thread 1 state=%s", lumiera_threadstate_names[t1->state]);
CHECK(LUMIERA_THREADSTATE_IDLE == t1->state);
@ -132,7 +133,7 @@ TEST ("many-sleepy-threads")
&sleep_fn,
(void *) &delay,
"just sleep a bit",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
}
}
@ -157,7 +158,7 @@ TEST ("toomany-random-sleepy-threads (compiletest only)")
&sleep_fn,
(void *) &delay[i],
"just sleep a bit",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
}
}
lumiera_threadpool_destroy();
@ -173,7 +174,7 @@ TEST ("no-function")
NULL,
NULL,
"process my test function",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
// cleanup
ECHO("finished waiting");
@ -194,7 +195,7 @@ TEST ("process-function")
&is_prime,
(void *)&number, //void * arg,
"process my test function",
&NOBUG_FLAG(NOBUG_ON)); // struct nobug_flag* flag)
&NOBUG_FLAG(test)); // struct nobug_flag* flag)
// cleanup
lumiera_threadpool_destroy();
@ -219,7 +220,7 @@ TEST ("many-random-sleepy-threads (compiletest only)")
&sleep_fn,
(void *) &delay[i],
"just sleep a bit",
&NOBUG_FLAG(NOBUG_ON));
&NOBUG_FLAG(test));
}
}
lumiera_threadpool_destroy();