_ | 覦覈襦 | 豕蠏手 | 殊螳 | 譯殊碁
FrontPage › 襦語讌

Contents

1 覓語
2 襭1
3 襭2


1 覓語 #

螳 れ螻 螳 讌覓語 覦.

襦襯 危襴貅伎 語. 讌襷 襦螳 ろ 蟆 襷螻 苦給. 谿朱 ろ ?

企 覓語 讌 覓語. 2螳讌 襭 .

  1. COM 螳 伎.
  2. LOCK朱 譟一.

れ 蠏 襭企.

2 襭1 #


  1. app_reference 企 襷. (貉殊 spname, refcount)
  2. 襦 ろ spname螻 refcount襯 蟆伎 refcount螳 1 伎企 蠍壱螻, 0企 ろ
  3. 襦 襷 襷讌襷 refcount -1 伎. 蟲 企慨覃..


use tempdb
go
--drop table app_reference
create table app_reference
(
	spname nvarchar(255) primary key
,	refcount int
)

--蟯襴 sp襯 覩碁Μ 焔.
insert app_reference values('usp_test', 0)
go

create proc usp_test
as
declare @refcount int

while(1=1)
begin
	update app_reference
	set @refcount = refcount = refcount + 1
	where spname = 'usp_test'

	if @refcount = 1
		break
	else
		waitfor delay '00:00:5'		
end

select 1
waitfor delay '00:00:20'
/*
	code..
*/

update app_reference
set refcount = 0
where spname = 'usp_test'
go

襦襯 ろ覃 20豐螳 ろ 蠍壱. 20豐 るジ 語 app_reference襯 譟壱 覲企 refcount螳 1 蟆 . 20豐螳 讌覃 襦 危 讌, 襷讌襷 refcount襯 -1 蟆企. 蠏碁覩襦 豕譬朱 語 1襦 讌 覦 . 襦螳 ろ譴 る襯 殊狩 朱襦 try ~ catch 襯 伎 語襴螻, 觜 appreference refcount襯 覈 0朱 豐蠍壱 る 襦襯 語襦 れ 朱 譬 蟆企.

觜訣 覦覯朱.. 襦 語襷 ろ 覯襯 譯朱 覦覯 螻ろ 覲朱 .

3 襭2 #

GETAPPLOCK or RELEASELOCK 伎.
蠍 蠍郁鍵..
企: : るジ讓曙 襦螻豺 企Ν 譯殊語. 襦螻豺
EditText : Print : Mobile : FindPage : DeletePage : LikePages : Powered by MoniWiki : Last modified 2018-04-13 23:12:52

覦 企朱 襦 譴讌 襷. 覦 覩瑚 . 蠏 襾碁ゼ 覲企. 豪Μ 蠍語 蟾讌 碁危 蟆企.