Hello
Thread LOCK
Is it correct to place the Thread Lock here?
If you place it here, Thread Lock will not work.
K
Thread LOCK
Is it correct to place the Thread Lock here?
If you place it here, Thread Lock will not work.
C#:
private static object syncresetdb = new Object();
public string GetList(ref DataFormat mts, bool setItem = false) //<====== variable(mts) Do variables affect thread LOCK?
{
lock (syncresetdb) //<======== Thread LOCK
{
string ret = null;
if (mts.AttrList.Count > 0)
mts.ViewLayer = -1;
mts.ViewLayer++;
DBAttrListDataFormat dbAttrViewList = DBAttrList.Instance(DBName).DBAttrViewList;
IEnumerable<string[]> DBAttrListResult;
try
{
foreach (string[] row in Result)
{
IEnumerable<string[]> valdt = GetAttrSetValueList(key, mts);
mts.SetAttrValueList(key, valdt, DBAttrList.Instance(DBName).TransDBEng, viewname, viewnameshown, depth, isIdentify, isEssential, ismulti, layer);
mts.ViewLayer = layer;
if (delList.ContainsKey(key))
{
bool notContains = false;
if (delList[key] != null)
{
string[] delvaluelist = delList[key].Split(',');
foreach (string devalue in delvaluelist)
{
if (!mts.AttrList[key].ValueList.Contains(devalue))
{
if (!setFirstItem)
{
mts.AttrList[key].ValueList.Add(devalue);
}
}
}
}
}
}
}
catch (Exception e)
{
return ret;
}
return ret;
}
}
Last edited: