I want to dequeue the elements of a collection one by one then store their values in a MYSQL database.
When the first element is dequeued I want to start a thread to update the database, then when the second element is dequeued I want to start another thread.
When the first thread finishes execution, I want to reuse it handle the third element of in the queue. Then, after the second thread finishes execution, I want to reuse it to handle the fourth element in the queue. I want to continue this way until all the elements in the queue are processed.
These all process handle the another thread at 1ms.
Does anyone know how to process a collection one by one using two threads?dequeue the element one by one then stored this value to the MYSQL database.
when first element dequeue then start another thread to update the database,
then second element dequeue then start another thread , when first finish execution handle the third element of the queue then second handle the fourth element & so on..
these all process handle the another thread at 1ms.
if any one known to how to start the one by one thread then tell me the solution.
thanks in advance.