forked from enlightenment/efl
improve sched_getaffinity() usage.
* handle error code and print out error message, this should remove invalid access traces from valgrind. * give "0" as pid to get self affinity, this is documented in the man page. SVN revision: 41118
This commit is contained in:
parent
3871aed422
commit
0567fd7bf2
|
@ -11,6 +11,7 @@
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
static sigjmp_buf detect_buf;
|
static sigjmp_buf detect_buf;
|
||||||
#endif
|
#endif
|
||||||
|
@ -255,7 +256,11 @@ evas_common_cpu_count(void)
|
||||||
|
|
||||||
if (cpus != 0) return cpus;
|
if (cpus != 0) return cpus;
|
||||||
|
|
||||||
sched_getaffinity(getpid(), sizeof(cpu), &cpu);
|
if (sched_getaffinity(0, sizeof(cpu), &cpu) != 0)
|
||||||
|
{
|
||||||
|
printf("[Evas] could not get cpu affinity: %s\n", strerror(errno));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
for (i = 0; i < TH_MAX; i++)
|
for (i = 0; i < TH_MAX; i++)
|
||||||
{
|
{
|
||||||
if (CPU_ISSET(i, &cpu)) cpus = i + 1;
|
if (CPU_ISSET(i, &cpu)) cpus = i + 1;
|
||||||
|
|
Loading…
Reference in New Issue