I'm new to embedded Linux so this question could be very simple for many of you. Most probably, it isn't directly related to embedded world, but to Linux OS generally. Anyway I think it is a common scenario in embedded applications.
I'm going to develop a local/remote control of an electronic device. It communicates through a RS485 link. The local control will be a touch-screen display (I'm going to use QT graphic libraries). The remote control will be HTTP (web server).
I think a good approach will be to develop a simple application, the poller, that communicates with the electronic device and implements the RS485 protocol. The poller continuously acquires the current status/settings of the device and store them in some "shared" way.
The graphic application (QT-based) and the web server (CGI) should access to the data retrieved by the poller.
What is the best method to share the data generated by an application (the poller) among two or more applications (QT and CGI)? In this scenario, I think it's important to lock the "shared data" before accessing them (reading or writing), in order to avoid reading incoerent data. Indeed, if the poller writes the data at the same time (Linux OS is multi-tasking) the web server reads them, they could be incoerent.
I'm thinking to use SQLite database to store the data. The poller writes the database, HTTP and QT reads from it. It seems SQLite will take care the multi-thread/multi-process scenario.
Any suggestions?