A
archana
Hi all,
Need some suggestion on implementating locking mechanism.
currently i have multple asynchronous request which have one callback
function. In callback , i am traverssing through dictionary and adding
into some shared dictionary, Callback is shared accross multiple
thread. So to prevent more than one thread trying to add to sharred
dictionary i have enclosed in lock statement.
But I am thinking of removing lock statment from entire callback and
adding lock statment only when looking into shared resource and adding
to shared resource.
My query is will it cause any issue if more than one thread try to
look into dictionary and try to add same value at the same time to
dictionary.
Can anyone please shed some light on this/
thanks in advance.
Need some suggestion on implementating locking mechanism.
currently i have multple asynchronous request which have one callback
function. In callback , i am traverssing through dictionary and adding
into some shared dictionary, Callback is shared accross multiple
thread. So to prevent more than one thread trying to add to sharred
dictionary i have enclosed in lock statement.
But I am thinking of removing lock statment from entire callback and
adding lock statment only when looking into shared resource and adding
to shared resource.
My query is will it cause any issue if more than one thread try to
look into dictionary and try to add same value at the same time to
dictionary.
Can anyone please shed some light on this/
thanks in advance.