# --------------------------------------------------------------- #
# -- Copyright (c) 1994, 1995 Computer Sciences Department,    -- #
# -- University of Wisconsin-Madison, subject to the terms     -- #
# -- and conditions given in the file COPYRIGHT.  All Rights   -- #
# -- Reserved.                                                 -- #
# --------------------------------------------------------------- #

source $script_dir/vol.init

sm begin_xct

echo creating file
set f1 [sm create_file $volid ]

set PG_SZ       952

# change body width
set id_body_width %0[expr {$PG_SZ * .48}]d

echo [format $id_body_width 1]

echo creating r1 and r2
set r1 [ sm create_rec $f1 "" 11 [format $id_body_width 1] ]
set r2 [ sm create_rec $f1 "" 11 [format $id_body_width 2] ]
echo $r1 $r2

sm commit_xct

proc rem1 { rid } {
	sm begin_xct
	sync
	echo rem1 destroy
	sm destroy_rec $rid
	sync
	echo rem1 abort
	sm abort_xct
}

proc rem2 { rid } {
	sm begin_xct
	sync
	echo rem2 destroy
	sm destroy_rec $rid
	sync
	echo rem2 abort
	sm abort_xct
}

echo forking 1
set t1 [ fork_thread rem1 $r1 ]
echo forking 2
set t2 [ fork_thread rem2 $r2 ]

sync_thread $t1
sync_thread $t2
sync_thread $t1
sync_thread $t2
join_thread $t1 $t2


unset t1 t2 PG_SZ r1 r2 f1
