simplify thread pool configuration

fix segv

fix bug redeclaration of same struct in phy sim

Apply 1 suggestion(s) to 1 file(s)

code reveiw comments
This commit is contained in:
laurent
2022-09-02 11:36:47 +02:00
parent 8229f00d0e
commit aa2a36768c
63 changed files with 81 additions and 153 deletions
+13 -1
View File
@@ -111,7 +111,7 @@ void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name
if (measr) {
mkfifo(measr,0666);
AssertFatal(-1 != (pool->dummyTraceFd=
AssertFatal(-1 != (pool->dummyKeepReadingTraceFd=
open(measr, O_RDONLY| O_NONBLOCK)),"");
AssertFatal(-1 != (pool->traceFd=
open(measr, O_WRONLY|O_APPEND|O_NOATIME|O_NONBLOCK)),"");
@@ -130,6 +130,7 @@ void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name
int c=toupper(curptr[0]);
switch (c) {
case 'N':
pool->activated=false;
break;
@@ -161,6 +162,17 @@ void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name
}
}
void initFloatingCoresTpool(int nbThreads,tpool_t *pool, bool performanceMeas, char *name) {
char threads[1024] = "n";
if (nbThreads) {
strcpy(threads,"-1");
for (int i=1; i < nbThreads; i++)
strncat(threads,",-1", sizeof(threads-1));
}
threads[sizeof(threads-1)]=0;
initNamedTpool(threads, pool, performanceMeas, name);
}
#ifdef TEST_THREAD_POOL
volatile int oai_exit=0;
+2 -2
View File
@@ -256,9 +256,8 @@ typedef struct thread_pool {
bool activated;
bool measurePerf;
int traceFd;
int dummyTraceFd;
int dummyKeepReadingTraceFd;
uint64_t cpuCyclesMicroSec;
uint64_t startProcessingUE;
int nbThreads;
notifiedFIFO_t incomingFifo;
struct one_thread *allthreads;
@@ -389,5 +388,6 @@ static inline int abortTpool(tpool_t *t) {
return nbRemoved;
}
void initNamedTpool(char *params,tpool_t *pool, bool performanceMeas, char *name);
void initFloatingCoresTpool(int nbThreads,tpool_t *pool, bool performanceMeas, char *name);
#define initTpool(PARAMPTR,TPOOLPTR, MEASURFLAG) initNamedTpool(PARAMPTR,TPOOLPTR, MEASURFLAG, NULL)
#endif