Skip to content
Permalink
Browse files

Adds esl_threads_GetCPUCount().

  • Loading branch information...
cryptogenomicon committed Aug 21, 2017
1 parent 2454944 commit 337448f6055a2138d53deb9da262cce5c74cc138
Showing with 17 additions and 0 deletions.
  1. +16 −0 esl_threads.c
  2. +1 −0 esl_threads.h
@@ -353,6 +353,22 @@ esl_threads_CPUCount(int *ret_ncpu)
}


/* Function: esl_threads_GetCPUCount()
* Synopsis: Returns the number of CPU cores on machine.
* Incept: SRE, Mon Aug 21 08:52:29 2017
*
* Purpose: Identical to <esl_threads_CPUCount()>, except
* it directly returns the result.
*/
int
esl_threads_GetCPUCount(void)
{
static int ncpu = -1; // so we only make system calls once.
if (ncpu == -1) esl_threads_CPUCount(&ncpu);
return ncpu;
}


/*****************************************************************
* 3. Example
*****************************************************************/
@@ -32,5 +32,6 @@ extern void *esl_threads_GetData (ESL_THREADS *obj, int workeridx);
extern int esl_threads_Finished(ESL_THREADS *obj, int workeridx);

extern int esl_threads_CPUCount(int *ret_ncpu);
extern int esl_threads_GetCPUCount(void);

#endif /*eslTHREADS_INCLUDED*/

0 comments on commit 337448f

Please sign in to comment.
You can’t perform that action at this time.