Re: How to wait for file closing?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Apparently, I won't be able to do without lock-files. I have C-code, that get data from optical sensors and Eu-code, that control robot.

Pseudo-code of C-part:
0. delete "whattodo", if it exist
1. get data from optic sensors
2. put data to file "thatisee"
3. create empty file "whattodo"
4. wait for file "turnleft", "turnrght" or "goahead"
5. send order to engines
6. delete files "turnleft", turnrhgt" and "goahead"
7. go to step 1

Pseudo-code of Eu-part:
1. wait for file "whattodo"
2. read file "thatisee"
3. get answer from AI
4. rename "whattodo" to "turnleft", "turnrght" or "goahead"
5. go to step 1

OK?

Whether additional actions are necessary? Whether it is necessary to check, what the file "thatisee" was really updated after step 2?

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu