Re: memcpy-ing structs with atomic variables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Feb 15, 2005 at 12:54:26PM -0800, Om wrote:
> hi,
> 
> How should I copy one structure to another one, when the
> definition includes one atomic variable?
> 
> struct kobject is an example.

Why would you ever want to copy a kobject from one place to another?
That's guaranteeing a world of hurt when you try to tear down that
kobject (or it's copy) sometime later.

Other than that, it's fine to use memcpy to copy a atomic variable as
long as you are sure no one else is trying to modify it at that moment
in time (and for a live kobject, you can never be assured of that,
sorry.)

thanks,

greg k-h

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux