Re: can linux RT thread corrupt global variable?
"Ming Lei" <[email protected]> Tue, 6 May 2003 10:50:08 -0700
| Newsgroups | gmane.linux.ngpt.user |
|---|---|
| Message-ID | <[email protected]> |
I used locking for all the reads and writes to cpl when the problem initialy surfaced. Interestingly the problem was the same after locking was used. Like I said, the problem either occured during context switch, or during the normal execution of a single thread. ----- Original Message ----- From: "Thorsten Holtkaemper" <[email protected]> To: "Ming Lei" <[email protected]> Sent: Tuesday, May 06, 2003 5:07 AM Subject: Re: [pthreads-users] can linux RT thread corrupt global variable? > On Tuesday 06 May 2003 02:39, Ming Lei wrote: > > There is a global variable I define as 'int cpl'. All the threads and main > > process may alter cpl at any time. cpl may have one of these values {0, > > 0xf000006e, 0xf0000068, 0xe0000000, 0xe0000060}. > > I'm not really sure if this is right, but if I understand correctly you access > this global variable without locking, assuming that the access to an integer > is an atomic operation. Depending on the platform and the implementation this > might not be true and lead to the experienced effect. > > But again - may be I'm plain wrong ... > > Regards, > Thorsten > > P.S.: This mail was also sent to the NGPT mailing-list.