Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

static dictonaries / thisLock - thread safe? #15

@dhoelzl

Description

@dhoelzl

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions