Advertisement
Guest User

Untitled

a guest
Jul 20th, 2017
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 1.00 KB | None | 0 0
  1.   # 16
  2.    [ # Run in a separate subshell with job control enabled.
  3.      '(set -m; ' .
  4.      # (1) At 0s, grab write lock; after 0.5s, write 'aaa' and exit
  5.      '(echo aaa | ./osprdaccess -w 3 -l -d 0.5) & ' .
  6.      # (2) At 0.1s, wait for read lock; print first character then X
  7.      #     -> Sleeping until 0.1, then blocking, killed at 0.3
  8.      '(sleep 0.1 && ./osprdaccess -r 1 -l | sed s/$/X/ && sleep 1) & ' .
  9.      'bgshell1=$! ; ' .
  10.      # (3) At 0.2s, wait for read lock; print first character then Y
  11.      #     -> Acquire at 0.5, print at 0.5, then block, killed at 0.6
  12.      '(sleep 0.2 && ./osprdaccess -r 1 -l | sed s/$/Y/ && sleep 1) & ' .
  13.      'bgshell2=$! ; ' .
  14.      # (4) At 0.3s, kill processes in (2); this may introduce a "bubble"
  15.      #     in the wait queue that would prevent (3) from running
  16.      'sleep 0.3 ; kill -9 -$bgshell1 ; ' .
  17.      # (5) At 0.6s, kill processes in (3)
  18.  
  19.      'sleep 0.3 ; kill -9 -$bgshell2 ' .
  20.      # Clean up separate shell.
  21.      ') 2>/dev/null',
  22.      "aY"
  23.    ],
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement