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