File: mutex.sra
Size: 911
Date: Mon, 31 Dec 2018 21:14:38 +0100
$PBExportHeader$mutex.sra
forward
global type mutex from application
end type
global transaction sqlca
global dynamicdescriptionarea sqlda
global dynamicstagingarea sqlsa
global error error
global message message
end forward

global variables

end variables

global type mutex from application
string appname = "mutex"
end type
global mutex mutex

on mutex.create
appname="mutex"
message=create message
sqlca=create transaction
sqlda=create dynamicdescriptionarea
sqlsa=create dynamicstagingarea
error=create error
end on

on mutex.destroy
destroy(sqlca)
destroy(sqlda)
destroy(sqlsa)
destroy(error)
destroy(message)
end on

event open;n_mutex ln_mutex

// check for previous instance of exe
If ln_mutex.of_apprunning() Then
   MessageBox("Mutex Example", &
      "Only one copy of the application is allowed!", &
      StopSign!)
   Halt
End If

Open(w_main)

end event

  • application mutex(sra)