MicrosoftEdge-Extensions-Demos icon indicating copy to clipboard operation
MicrosoftEdge-Extensions-Demos copied to clipboard

static dictonaries / thisLock - thread safe?

Open dhoelzl opened this issue 8 years ago • 0 comments

Are the following dictionaries

static Dictionary<int, AppServiceConnection> connections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, AppServiceConnection> desktopBridgeConnections = new Dictionary<int, AppServiceConnection>();
static Dictionary<int, BackgroundTaskDeferral> appServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();
static Dictionary<int, BackgroundTaskDeferral> desktopBridgeAppServiceDeferrals = new Dictionary<int, BackgroundTaskDeferral>();

thread safe?

They are accessed all over the code on different threads (according to my debugging experience) (OnBackgroundActivated, OnAppServiceRequestReceived, OnAppServicesCanceled, OndesktopBridgeAppServiceRequestReceived, OndesktopBridgeAppServicesCanceled), but there is only a critical section with thisLock in OnBackgroundActivated.

Do I miss something?

dhoelzl avatar Nov 16 '17 14:11 dhoelzl