Access denied in concurrent access
Posted: 01 Apr 2016 04:36
Hi,
I have a problem with the dos batch raycast when executed on multicore. Expert needed!
I have semplified the code and found one possible cause.
EDIT:You have to run the test several times before catch errors and on a multicore machine is more difficult to catch them.
I have two file:
Slave.cmd
master.cmd:
Run the master and the error is visible in the slave output
slave.out:
master.out:
I thinks that the solution is LOCK the share resource (in this case job.bat) or catch the error with &&/|| or errorlevel
How can i do?
einstein1969
I have a problem with the dos batch raycast when executed on multicore. Expert needed!
I have semplified the code and found one possible cause.
EDIT:You have to run the test several times before catch errors and on a multicore machine is more difficult to catch them.
I have two file:
Slave.cmd
Code: Select all
@echo off
setlocal EnableDelayedExpansion
for /l %%. in () do if exist "job.bat" (
echo Job.bat Exist
echo Calling job.bat ...
call "job.bat"
echo Do job ... : "!job!"
!job!
echo deleting job.bat
del job.bat
)
master.cmd:
Code: Select all
@echo off
setlocal EnableDelayedExpansion
rem start the slave process
start "Slave" "%comspec%" /c "slave.cmd"
Title Master
>nul ping -n 2 127.0.0.1
rem prepare job
>job.bat.tmp echo set "job=set /a 2*3"
ren job.bat.tmp *.
Echo Done.
pause
Run the master and the error is visible in the slave output
slave.out:
Code: Select all
Job.bat Exist
Calling job.bat ...
Impossibile accedere al file. Il file è utilizzato da un altro processo.
Do job ... : ""
deleting job.bat
master.out:
Code: Select all
Done.
Premere un tasto per continuare . . .
I thinks that the solution is LOCK the share resource (in this case job.bat) or catch the error with &&/|| or errorlevel
How can i do?
einstein1969