<< Prev        Next >>

ID : 5036

Program Example 1 for Exclusion Control

This is a general example of exclusion control between tasks. It will be executed in Pro1-> Pro2-> Pro3 order.

'!TITLE "Program Example 1 for Exclusion Control"
' Program name "Pro1"

Sub Main

 Dim id as integer

 id = CreateMutex( “Blocking-Section” )

 TakeMutex id
 Run Pro2
 Run Pro3

  TakeMutex id

	For I1 =1 To 10
	  PrintDbg “pro1 - ” & I1
	  Delay 100
	Next 

  GiveMutex id

 DeleteMutex id

End Sub
'!TITLE "Program Example 1 for Exclusion Control"
' Program name "Pro2"
Sub Main

 Dim id as integer

 id = CreateMutex( “Blocking-Section” )

  TakeMutex id

	For I1 =1 To 10
	  PrintDbg “pro2 - ” & I1
	  Delay 100
	Next 

  GiveMutex id

 DeleteMutex id

End Sub
'!TITLE "Program Example 1 for Exclusion Control"
' Program name "Pro3"
Sub Main

 Dim id as integer

 id = CreateMutex( “Blocking-Section” )

  TakeMutex id

	For I1 =1 To 10
	  PrintDbg “pro3 - ” & I1
	  Delay 100
	Next 

  GiveMutex id

 DeleteMutex id

End Sub

ID : 5036

<< Prev        Next >>