Hi there,

I'm processing lots of files at a time. I get them, import csv into a mysql
table, do some post stuff, move the file.

I need to process these files one at a time. That is, I can't just
concatenate the files into one uber-file and process it.

One of the things I do is truncate the file that the csv is going into. I
import the data, and then do some other stuff on the table (a staging
table) then import the data into the production table.

If file 2 starts being processed before file 1 has finished, the staging
table will be truncated before the data has been processed and moved to
production. SO I need the other files to Wait before proceeding.

This sounds like a job for Wait/Notify but I can't get the logic to work.
It should go:

1/ Get File 1
2/ If no other files being processed then proceed with process
3/ Import
4/ Process
5/ Move data to production
6/ Move the file

...
7/ Start processing File 2

I'm missing something obvious here or I'm barking up the wrong tree with
Wait/Notify.

What's the right way to do this?

Many thanks,

---=Laurie

Reply via email to