Write a concurrent data processing pipeline and explain how you handle race conditions and synchronization.
Implement process_pipeline(records, worker_count). Each record is a dictionary with integer id and string text; return one result per record in the original input order, with id, word_count, and unique_word_count fields. Use concurrency primitives to separate production from processing, and ensure deterministic results without race conditions.
id and a string textdef process_pipeline(records, worker_count):