Function Get_Latch(latch_name,mode) { If Mode eq ‘immediate’ { If Fast_Get(latch_name) { return TRUE Else { return FALSE } } Else { If Fast_Get(latch_name) Then { v$latch.gets++ return TRUE } Else { v$latch.misses++ for try = 0 .. large_number { if Spin_Get(latch_name) Then { return TRUE } Else { T0 = time Sleep(try) T1=time Register_Event("latch free",T1-T0) } } -- spin/sleep loop } } } Function Fast_Get(latch_name) { If try_to_get_latch(latch_name) Then { return TRUE } Else { return FALSE } } Function Spin_Get(latch_name) { v$latch.spin_get++ for i = 1 to _spin_count { If Fast_Get(latch_name) Then { return TRUE } } } Function Sleep(try) { v$latch.sleeps++ v$latch.sleep[try]++ sleeptime = decode(try,0,0,1,10,2,20,3,~40,4,~80,...~2000) sleep(sleeptime) }
转载于:https://blog.51cto.com/maclean/1278270
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/110480.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...