<< 向前        下一页 >>

ID : 5036

排他处理的程序示例1

一般任务间的排斥处理示例。按照Pro1-> Pro2-> Pro3的顺序执行。

'!TITLE "排他处理的程序示例1"
' 程序名 "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 "排他处理的程序示例1"
' 程序名 "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 "排他处理的程序示例1"
' 程序名 "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

<< 向前        下一页 >>