I have started five threads from main() function.
I have written three funtions as follows:
getConnectionToDatabase();
saveToDataBase();
closeConnection();
Now I want that main function should establish a connection to the database before starting those five threads by calling getConnectionToDataBase() so that each thread doesn't have to start a new connection.
Now I want that each thread should store the data by calling saveToDataBase() by first getting the connection established by the main() funtion.
How can I do that.
I can provide additional information if you need any.