BugID:16846667:bind main thread to cpu zerogit status!
@@ -138,9 +138,7 @@ void cpu_signal(uint8_t cpu_num)
void *cpu_entry(void *arg)
{
cpu_set_t mask;
- cpu_set_t get;
- CPU_ZERO(&get);
CPU_ZERO(&mask);
CPU_SET((int)arg, &mask);
@@ -257,6 +255,8 @@ void cpu_tmr_sync(void)
struct sigevent sevp;
timer_t timerid;
struct itimerspec ts;
+ cpu_set_t mask;
+
int i = 1;
uint8_t loop = 1;
int ret = 0;
@@ -264,6 +264,13 @@ void cpu_tmr_sync(void)
(void)i;
(void)loop;
+ CPU_ZERO(&mask);
+ CPU_SET(0, &mask);
+
+ if (pthread_setaffinity_np(pthread_self(), sizeof(mask), &mask) != 0) {
+ assert(0);
+ }
+
#if (RHINO_CONFIG_CPU_NUM > 1)
for (i = 1; i < RHINO_CONFIG_CPU_NUM; i++) {
if (pthread_create(&rhino_cpu_thread[i], NULL, (void *)cpu_entry, (void *)i) != 0) {
