String functions in different tasks

pnn
2016-04-21
2016-04-22
  • pnn - 2016-04-21

    Hi,

    in Codesys v.2 help there is a warning that string functions are not thread safe and the same function shouldn't be used in different tasks because there is a danger of overwriting.

    My question is, does this apply to all string functions - including LEN and FIND, which return INT - or only to the rest (LEFT, CONCAT etc.) that return STRING ? Can I safely use LEN and FIND from different tasks or they may return a wrong number?

    Thanks.

    --
    BTW is it possible a task switching to occur while a function executes, if there are no tasks triggered by events?

     
  • shooter - 2016-04-22

    dont worry to much.
    it indeed has to do with interupts etc. However just dont change a string in a interupt.
    when doing a for next loop it can be interupted. but if you have no interupts running it is no problem, as a function is completed (or a rung is done, however multilines are not obvious)

     

Log in to post a comment.