I also experimented the bug. It may SIGSEGV or hang. Or it may work, very rarely.
But I cannot reproduce it at all if change my app to stay on a single CPU:
int main(int argc, char * argv[] ) {
#ifdef QEMU cpu_set_t cpuSet; CPU_ZERO(&cpuSet); CPU_SET(0,&cpuSet); if (sched_setaffinity(getpid(), sizeof(cpu_set_t), &cpuSet) !=0) cerr << "sched_setaffinity failed" << endl; #endif /* QEMU */
I also experimented the bug.
It may SIGSEGV or hang. Or it may work, very rarely.
But I cannot reproduce it at all if change my app to stay on a single CPU:
int
main(int argc, char * argv[] )
{
#ifdef QEMU ZERO(&cpuSet) ; SET(0,& cpuSet) ; setaffinity( getpid( ), sizeof(cpu_set_t), &cpuSet) !=0)
cpu_set_t cpuSet;
CPU_
CPU_
if (sched_
cerr << "sched_setaffinity failed" << endl;
#endif /* QEMU */