hoanglo 3 Posted April 25, 2016 Report Share Posted April 25, 2016 Hi guys,Can Ubot handle it if I have multiple threads appending to one file?I've seen no problem so far but I'm just afraid that if 2 threads writing to a file at the same time it will cause some text not being written to the file. Please clear this up for me. Thanks Quote Link to post Share on other sites
abbas786 78 Posted April 25, 2016 Report Share Posted April 25, 2016 Hi guys,Can Ubot handle it if I have multiple threads appending to one file?I've seen no problem so far but I'm just afraid that if 2 threads writing to a file at the same time it will cause some text not being written to the file. Please clear this up for me. Thanks Use Free TinyMCE Plugin to lock your file and than do the write operations so that no 2 threads can write it at a time. Quote Link to post Share on other sites
hoanglo 3 Posted April 25, 2016 Author Report Share Posted April 25, 2016 Use Free TinyMCE Plugin to lock your file and than do the write operations so that no 2 threads can write it at a time. Thank you very much.So with the plugin, if 2 threads try to write at the same time, will one thread wait for the other to finish and then write? Quote Link to post Share on other sites
abbas786 78 Posted April 25, 2016 Report Share Posted April 25, 2016 Thank you very much.So with the plugin, if 2 threads try to write at the same time, will one thread wait for the other to finish and then write? Yeah this is the expected behavior of threads, you can test it with dummy data before doing anything with ur original data Quote Link to post Share on other sites
hoanglo 3 Posted April 25, 2016 Author Report Share Posted April 25, 2016 Yeah this is the expected behavior of threads, you can test it with dummy data before doing anything with ur original dataAwesome. Thanks a lot Quote Link to post Share on other sites
Bot-Factory 602 Posted April 25, 2016 Report Share Posted April 25, 2016 Hello. I would recommend the free File Management Plugin:plugin command("File Management.dll", "locked save to file", "", "") It has a thread safe save to file command. The problem with the lock command is, that it needs to execute the ubot command in an APi Container. And there are some known issues with Threads and API Containers. So I would go for the File Management Dll:http://network.ubotstudio.com/forum/index.php/topic/13237-free-file-management-plugin-multiple-commands-and-functions/ CheersDan 2 Quote Link to post Share on other sites
Frank 177 Posted May 9, 2016 Report Share Posted May 9, 2016 Good call Dan. I gotta tell you that the file management plugin is like the best free plugin around.Saved my bacon on several occasions. Frank Quote Link to post Share on other sites
ibins 0 Posted November 10, 2018 Report Share Posted November 10, 2018 (edited) Hello guys, What is the 2018 way to go, when appending to 1 file at multiple threads? I have fear my bot is crashing because of that. i dont want to collect all data in a variable because when bot crashes all is gone. The recommendation from Dan can only save and not append.plugin command("File Management.dll", "locked save to file", "", ""),i dont want to read the file first and then save it, over multiple threads, this is not practicable for me. for the tiny mce usage i did not have found any demo code yet. The other old plugin, with the lock{ function, didnt appear in the plugins. Many thanks, any help much appreciated! Edited November 10, 2018 by ibins Quote Link to post Share on other sites
HelloInsomnia 1103 Posted November 12, 2018 Report Share Posted November 12, 2018 Hello guys, What is the 2018 way to go, when appending to 1 file at multiple threads? I have fear my bot is crashing because of that. i dont want to collect all data in a variable because when bot crashes all is gone. The recommendation from Dan can only save and not append.plugin command("File Management.dll", "locked save to file", "", ""),i dont want to read the file first and then save it, over multiple threads, this is not practicable for me. for the tiny mce usage i did not have found any demo code yet. The other old plugin, with the lock{ function, didnt appear in the plugins. Many thanks, any help much appreciated! This plugin has thread lock and system wide lock. Both will lock it so that only one thread can get in at a time: https://network.ubotstudio.com/forum/index.php/topic/20002-free-heopas-custom-plugin-thread-lock-sqlite-thread-variables-email-ini-clipboard/ Quote Link to post Share on other sites
ibins 0 Posted November 13, 2018 Report Share Posted November 13, 2018 Many thanks HelloInsomnia for pointing me in the right direction! Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.