Can I use mutex between different functions?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Can I use mutex between different functions?

跳至解决方案
1,415 次查看
danielchai
Senior Contributor I

Hi All,

I am new to mutex and I read that the mutex is used for different tasks to share the resource.

My question is that can I use mutex in different functions?

Thank you.

-Daniel

0 项奖励
回复
1 解答
1,247 次查看
anthony_huereca
NXP Employee
NXP Employee

Hi Daniel,

  Yes, by making the mutex a global variable, you can use it across your code in different tasks and functions. Take a look at C:\Freescale\Freescale_MQX_4_0\mqx\examples\mutex\main.c to see an example of this being done.

-Anthony

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,248 次查看
anthony_huereca
NXP Employee
NXP Employee

Hi Daniel,

  Yes, by making the mutex a global variable, you can use it across your code in different tasks and functions. Take a look at C:\Freescale\Freescale_MQX_4_0\mqx\examples\mutex\main.c to see an example of this being done.

-Anthony

0 项奖励
回复