linux thread synchronization

后端 未结 5 945
北海茫月
北海茫月 2021-02-06 14:52

I am new to linux and linux threads. I have spent some time googling to try to understand the differences between all the functions available for thread synchronization. I sti

5条回答
  •  你的背包
    2021-02-06 15:24

    Application code should probably use posix thread functions. I assume you have man pages so type

    man pthread_mutex_init
    man pthread_rwlock_init
    man pthread_spin_init
    

    Read up on them and the functions that operate on them to figure out what you need.

    If you're doing kernel mode programming then it's a different story. You'll need to have a feel for what you are doing, how long it takes, and what context it gets called in to have any idea what you need to use.

提交回复
热议问题