DM_MUTEX_SCOPED_LOCK example

Can I request an example of using DM_MUTEX_SCOPED_LOCK? Thanks!

For example:

DM_MUTEX_SCOPED_LOCK(subscribers_mutex) {
    subscribers.insert(std::make_pair(subscriber_id, subscriber));
}

or

{
    DM_MUTEX_SCOPED_LOCK(subscribers_mutex);
    subscribers.insert(std::make_pair(subscriber_id, subscriber));
}

The second example is more clear on your intentions and is how we use it.

2 Likes

You can check how I use it in DefVideoAds NE: https://github.com/AGulev/DefVideoAds/blob/b169c1ea31af4434bf16bafc53d2e8a7ccf7700a/defunityads/src/DefUnityCallback.cpp#L7

3 Likes

Thank you both!

1 Like