Re: [问题] 关于多process执行顺序 (QT)

楼主: cty222 (纵裕)   2012-12-18 00:24:09
※ 引述《leolarrel (真.粽子无双)》之铭言:
: ※ 引述《cty222 (纵裕)》之铭言:
: : 好像写的不清不楚...
: : 在多写一些看能不能表达清楚...
: : 简单的说我是直接将C code的共享内存写法放进QT里出了问题
: : 以下为共用码
: : int main(void){
: : int shmid;
: : int *share ;
: : shmid = shmget(key,sizeof(int),IPC_CREAT|0644);
: : share = (int *)shmat( shmid, NULL, 0 ) ;
: : C code QT code
: : 1. *share = 0 ; | *share=0;
: : |
2. while(*share!=1){ | while(*share!=2){
: : printf("%d\n"*share);| *share = 1 ;
: : } | sleep(1); <
作者: KevinR (Kevin)   2012-02-20 19:21:00
volatile...

Links booklink

Contact Us: admin [ a t ] ucptt.com