DM_MUTEX_SCOPED_LOCK example

#1

Can I request an example of using DM_MUTEX_SCOPED_LOCK? Thanks!

0 Likes

#2

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));
}
0 Likes

#3

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

2 Likes

#4

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

3 Likes

#5

Thank you both!

1 Like