how to reduce the threading timing issue?

may be my title not that appropriate to my problem ...

i'm face issue that i have 2 thread pool queue in which the 1st thread queue has requests (1st job creating a object A and 2rd job is deleting the same object created before ).

But at end of the processing of job in thread pool 1 we are creating a job in thread pool 2 with passing object as argument.

problem is after creating the job in 2rd thread pool, my 1st queue is started processing the 2rd job (i.e deletion of object). at that time the 2rd thread pool is processing the object created by 1st job. so that i getting some errors.

i can't create a lock on the object since it is complex object which has several shared sub class object by other threads.

can any one help how reduce the time of processing in 2rd thread pool or to make some wait for 1st thread pool

i mean some effective steps or best practices to reduce the time of processing.
Can't you add the deleting job at the end of the processing job, instead of adding them at the same time then checking if the processing job is finished before deleting?
Topic archived. No new replies allowed.