I am stuck again. This time the issue is with the need of global object.
This is the general idea of the program:
Main -> Window -> Drawing Area.
I have 2 threads (pthreads) going on in Main, other taking care of the database (refreshing every minute) and the other one doing the drawing(while taking data from said db). Now, I would like to refresh Drawing Area at the same time as the database refreshes. There is a function in Drawing Area that can make it happen.
What is the best way to go about this? I am not too keen on anything global(and I have no knowledge how to implement one in this situation) Might be even impossible. All I know is that I need to use the same objects that exist, I cannot create new ones. As a beginner, I have no idea what other choices I have.
Then wouldn't it be easier to do everything in one thread? Set up a timer event so that f() gets called every 60 seconds, and have f() refresh the database and redraw the UI.