File: test_sem.pro

package info (click to toggle)
gnudatalanguage 0.9.2-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,212 kB
  • sloc: cpp: 114,857; sh: 11,170; makefile: 362; awk: 18; python: 6; ansic: 4
file content (28 lines) | stat: -rw-r--r-- 667 bytes parent folder | download | duplicates (3)
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