lundi 21 avril 2014

c - puis-je utiliser <stdatomic.h> de C11 dans driver Linux, ou devons-nous je dois pour utiliser des fonctions de mémoire-barrières Linux? - Stack Overflow


Can I use #include <stdatomic.h> and atomic_thread_fence() with memory_order from C11 in Linux driver (kernel-space), or do I must to use Linux functions of memory-barriers:



Using:



  • Linux-kernel 2.6.18 or greater

  • GCC 4.7.2 or greater




If you are writing kernel code, you should do it in C, and do it in the version of C required by the current kernel (shipping gcc). If you want to get it accepted into mainline (or write it as if it were going to get accepted), you should use the Linux functions. You will also find that they work without unexpected surprises, and you will get better debugging help.


Summary: use the linux functions.



Can I use #include <stdatomic.h> and atomic_thread_fence() with memory_order from C11 in Linux driver (kernel-space), or do I must to use Linux functions of memory-barriers:



Using:



  • Linux-kernel 2.6.18 or greater

  • GCC 4.7.2 or greater



If you are writing kernel code, you should do it in C, and do it in the version of C required by the current kernel (shipping gcc). If you want to get it accepted into mainline (or write it as if it were going to get accepted), you should use the Linux functions. You will also find that they work without unexpected surprises, and you will get better debugging help.


Summary: use the linux functions.


0 commentaires:

Enregistrer un commentaire