Ok, here is the piece of code where I found it strange:
printf("di consumerthread : mulai isi data, itmsg = %d\n",itmsg);
msgq->data[itmsg]=rec_data;
printf("di consumerthread : selesai isi data, itmsg = %d\n",itmsg);
What I found strange is the output:
di consumerthread : mulai isi data, itmsg = 42
di consumerthread : selesai isi data, itmsg = 98
How come the itmsg variable suddenly changes from 42 to 98 after this line?
msgq->data[itmsg]=rec_data;
Can anybody please tell me how to solve this problem and the cause of this strange output?
Ok, I finally found what’s wrong
Sorry if I dont give you enough info because my head is in a mess to explain it in detail..
So, what I did to solve it is:
changing all type of global variable, including itmsg, to static
and all type of procedure and function which use the global variable to static
and it solved all of my problem!
though I still dont know what’s static function..
Thanks for all of your help! 😀