- 论坛徽章:
- 11
|
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
void *start_routine(void *arg)
{
sleep(2);
*(int *)arg = 1;
return NULL;
}
int main()
{
/*volatile*/ int stop=0;
unsigned long rbp,rsp;
__asm__ __volatile__(
"movq %%rbp, %%rax\n\t"
"movq %%rsp, %%rbx\n\t"
"movl $1, (%%rsp)"
:"=a"(rsp), "=b"(rsp)
:
:"memory");
//printf("rbp:%p,rsp:%p,&rbp:%p,&rsp:%p,&stop:%p\n",(void*)rbp,(void*)rsp,(void*)&rbp,(void*)&rsp,&stop);
//printf("rbp:%p,rsp:%p,&stop:%p\n",(void*)rbp,(void*)rsp,&stop);
int b;
b=stop;
while(!b)
{
printf("%d\n",b);
sleep(1);
}
return 0;
}
这个例子能说明问题。。。。。。。。 |
|