Hi again, I am planning to write some data I recieve and process in real-time and write the output to ini or sqlite database. So I want to know if there is a wx in-built function to make a I/O queue for asynchronized local file write function, the idea is like this:
1. Process data and make a struct in memory
2. Post the data struct to a dedicated thread with a I/O queue
3. dedicated I/O thread writes the file every [some interval] or priority-based
Thanks again.
dedicated thread for writing logs and text data/sql Topic is solved
-
- Experienced Solver
- Posts: 81
- Joined: Wed Oct 19, 2016 1:41 pm
Re: dedicated thread for writing logs and text data/sql
In the default configuration SQLite is thread-safe, so you wouldn't need to do anything. Just write into it from any thread.
https://sqlite.org/threadsafe.html
If you want a dedicated thread for writing, use wxMessageQueue.
http://docs.wxwidgets.org/trunk/classwx ... _01_4.html
https://sqlite.org/threadsafe.html
If you want a dedicated thread for writing, use wxMessageQueue.
http://docs.wxwidgets.org/trunk/classwx ... _01_4.html
Use the source, Luke!
-
- Experienced Solver
- Posts: 81
- Joined: Wed Oct 19, 2016 1:41 pm
Re: dedicated thread for writing logs and text data/sql
Thanks doublemax.doublemax wrote:In the default configuration SQLite is thread-safe, so you wouldn't need to do anything. Just write into it from any thread.
https://sqlite.org/threadsafe.html
If you want a dedicated thread for writing, use wxMessageQueue.
http://docs.wxwidgets.org/trunk/classwx ... _01_4.html
Hmm is wxSqlite easier to implement than the vanilla stand-alone sqlite?
I remember using sqlite ages ago and it's pretty tricky to get it to work smoothly back then.
Re: dedicated thread for writing logs and text data/sql
I think yes. First of all it's a C++ wrapper which does all the initialization, memory management etc for you. Also when dealing with wxString, it handles the conversion to/from UTF8 for you.Hmm is wxSqlite easier to implement than the vanilla stand-alone sqlite?
Use the source, Luke!
-
- Experienced Solver
- Posts: 81
- Joined: Wed Oct 19, 2016 1:41 pm
Re: dedicated thread for writing logs and text data/sql
Thanks, I will give it a shot some time.doublemax wrote:I think yes. First of all it's a C++ wrapper which does all the initialization, memory management etc for you. Also when dealing with wxString, it handles the conversion to/from UTF8 for you.Hmm is wxSqlite easier to implement than the vanilla stand-alone sqlite?