Global counter increase - problem with result

dariesto

Client
Регистрация
03.11.2011
Сообщения
124
Благодарностей
9
Баллы
18
Hi

When zennoposter execute macro which increases value of global counter the result of this field is not the number in the counter after increase but the value that increases the counter. In the Zennoposter manual this macro is decribed that result should be the value of the global counter after increase.

I'll be deeply grateful for solving this problem.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
To get the value of the global counter use result of {-Global.CounterGet-|-globalCounter-}
 

dariesto

Client
Регистрация
03.11.2011
Сообщения
124
Благодарностей
9
Баллы
18
Thanks for reply. I'm just worrying when getting value in next step from global counter (so doing it in two steps: increase value>get value) while template is executed in many threads, the another thread being just behind can get same value from counter before first thread manage to increase global counter.

Please let me know if I'm wrong.

Will be thankful for reply.
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
834
Баллы
113
Thank you for your explanation. Execution value of counter addition is value on which counter has been increased. Global counters are shared variables, but if one thread working with it then none other can lock it at the same time.
Agreed that in some templates with multithreading might be occured some problems related with global counters.
 

dariesto

Client
Регистрация
03.11.2011
Сообщения
124
Благодарностей
9
Баллы
18
Thanks for claryfying my issue, I just followed information in manual so it should be corrected because described result for this macro is value after increase. I will be also very glad if you consider to change result of this macro in next version of zennoposter. Thanks again for explanation.
 

Кто просматривает тему: (Всего: 2, Пользователи: 0, Гости: 2)