惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园 - Franky
D
Docker
Jina AI
Jina AI
The GitHub Blog
The GitHub Blog
博客园 - 聂微东
B
Blog RSS Feed
大猫的无限游戏
大猫的无限游戏
M
MIT News - Artificial intelligence
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
博客园 - 叶小钗
爱范儿
爱范儿
D
DataBreaches.Net
Hugging Face - Blog
Hugging Face - Blog
IT之家
IT之家
Recent Announcements
Recent Announcements
U
Unit 42
腾讯CDC
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
宝玉的分享
宝玉的分享
量子位
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Microsoft Azure Blog
Microsoft Azure Blog

博客园 - shcity

Troubleshooting on TransactionScope Parse string to JSON object Parse date in js blockUI doesn't close when download file in asp.net define namespace in JS Dense_Rank(), Row_Number(), Rank() in sql server Fix the issue that cannot open SSIS in BIDS three ways creating custom helpers to show RadioButtonList in MVC using JavaScriptSerializer to serialize object to json using ISerializable to control serialization and deserialization ViewStateAutoManager ReportingService formatting Build my own DataTable split a string into an array through comma div with separated html template - shcity 正则表达式替换日期 半透明的div对话框 foreach 的自动转化类型 在Ajax1.0中调用页面CS文件中的方法
reading and writing variable through lock in SSIS script ...
shcity · 2013-03-03 · via 博客园 - shcity

why we need lock to read or write variables, if we don't use lock, sometimes a deadlock will occur.

writing variable:

private void WriteValue(string name,object value)
        {
            Variables variables = Dts.Variables;

            try
            {
                Dts.VariableDispenser.LockOneForWrite(name, ref variables);
                variables[name].Value = value;
            }
            finally
            {
                if (variables.Locked)
                {
                    variables.Unlock();
                }
            }

        }

reading variable:

private object ReadValue(string name)
        {
            Variables variables = Dts.Variables;

            try
            {
                Dts.VariableDispenser.LockOneForRead(name, ref variables);
                return variables[name].Value;
            }
            finally
            {
                if (variables.Locked)
                {
                    variables.Unlock();
                }
            }
        }

 more information:

http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.variabledispenser.lockforwrite.aspx