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