lkml.org 
[lkml]   [2005]   [Apr]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Doubt Regarding Multithreading and Device Driver
From
Date
> I am storing something into struct file*filp->private_data.
> As this is not shared across processes I am not doing any locking
> stuff while accessing or putting anything into it.
>
> Will There be a race condition in a multithreaded program in the ioctl
> call on smp kernel accessing filp->private_data.

If you are only accessing ->private_date in an ioctl() method, you have
lucked out: straight ioctl() remains protected by the big kernel lock,
and you will not have concurrent accesses.

That said, it's not that hard for you to add the proper locking yourself
and have code which will be robust in the future. Why not do it right?
There's lots of information in LDD3 (http://lwn.net/Kernel/LDD3/) and
elsewhere on how to do that.

jon

Jonathan Corbet
Executive editor, LWN.net
corbet@lwn.net

-
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/

\
 
 \ /
  Last update: 2005-04-27 17:41    [W:0.036 / U:1.652 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site