volatile variable

From: Dinesh Gandhewar (dinesh_gandhewar@rediffmail.com)
Date: Fri Aug 01 2003 - 05:57:06 EST


Hello,

If a system call is having following code.

add current process into wait quque ;
while (1)
{ set task state INTERRUPTIBLE ;
    if (a > 0)
      break ;
    schedule() ;
}
set task state RUNNING ;
remove current from wait queue ;

If an interrupt service is having following code

set a = 512 ;

'a' is a global variable shared in ISR and system call

Do I need to define a as 'volatile int a ;' ? Why?

Thanks & Regards,
Dinesh

___________________________________________________
Download the hottest & happening ringtones here!
OR SMS: Top tone to 7333
Click here now:
http://sms.rediff.com/cgi-bin/ringtone/ringhome.pl

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 07 2003 - 22:00:16 EST