lock003.tcl
上传用户:tsgydb
上传日期:2007-04-14
资源大小:10674k
文件大小:1k
源码类别:

MySQL数据库

开发平台:

Visual C++

  1. # See the file LICENSE for redistribution information.
  2. #
  3. # Copyright (c) 1996, 1997, 1998, 1999, 2000
  4. # Sleepycat Software.  All rights reserved.
  5. #
  6. # $Id: lock003.tcl,v 11.16 2000/08/25 14:21:51 sue Exp $
  7. #
  8. # Exercise multi-process aspects of lock.  Generate a bunch of parallel
  9. # testers that try to randomly obtain locks.
  10. proc lock003 { dir {iter 500} {max 1000} {procs 5} {ldegree 5} {objs 75} 
  11. {reads 65} {wait 1} {conflicts { 3 0 0 0 0 0 1 0 1 1}} {seeds {}} } {
  12. source ./include.tcl
  13. puts "Lock003: Multi-process random lock test"
  14. # Clean up after previous runs
  15. env_cleanup $dir
  16. # Open/create the lock region
  17. set e [berkdb env -create -lock -home $dir]
  18. error_check_good env_open [is_substr $e env] 1
  19. set ret [$e close]
  20. error_check_good env_close $ret 0
  21. # Now spawn off processes
  22. set pidlist {}
  23. for { set i 0 } {$i < $procs} {incr i} {
  24. if { [llength $seeds] == $procs } {
  25. set s [lindex $seeds $i]
  26. }
  27. puts "$tclsh_path
  28.     $test_path/wrap.tcl 
  29.     lockscript.tcl $dir/$i.lockout
  30.     $dir $iter $objs $wait $ldegree $reads &"
  31. set p [exec $tclsh_path $test_path/wrap.tcl 
  32.     lockscript.tcl $testdir/lock003.$i.out 
  33.     $dir $iter $objs $wait $ldegree $reads &]
  34. lappend pidlist $p
  35. }
  36. puts "Lock003: $procs independent processes now running"
  37. watch_procs 30 10800
  38. # Remove log files
  39. for { set i 0 } {$i < $procs} {incr i} {
  40. fileremove -f $dir/$i.lockout
  41. }
  42. }