1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
pro test_sem
s = '_test_sem'
spawn, '../src/gdl -quiet -e "s = ''' + s + ''' & help, sem_create(s, destroy_semaphore=0) & help, sem_lock(s) & wait, 3 & sem_release, s"', unit=p
print, '-- background process:'
str = ' '
readu, p, str & print, str
err = 0
print, '-- foreground process:'
status = sem_create(s) ; 1
help, status
if status ne 1 then err++
status = sem_lock(s)
help, status
if status ne 0 then err++
wait, 6
status = sem_lock(s)
help, status
if status ne 1 then err++
sem_release, s
if err ne 0 then exit, status=1
end
|