Can I use mutex between different functions?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Can I use mutex between different functions?

Jump to solution
1,420 Views
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 Kudos
Reply
1 Solution
1,252 Views
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

View solution in original post

0 Kudos
Reply
1 Reply
1,253 Views
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 Kudos
Reply