The question is pointless. Of course, if you put four threads and the lock and the queue in one class and made them private, which is good, the lock and queue are shared. What to ask about?
I must say,
you go in the right direction. I can see three problems:
First, the number 4 is hard-coded and used in two places, which is not supportable: what if you want to change it? You might change is in one place, forget in another one, etc. Always avoid any
immediate constants like this 4, use explicit constant defined only in one place for whole solution. But why making it a constant at all? Better yes, abstract it out, make it a parameter of the class. (Also bad name for a class: never use abbreviations).
Second problem: data type
object
is bad. It will need type casts, which is bad. Make your class generic with data type made a generic parameter.
Third problem: lock is redundant. You need only the event wait handle. In many situation, you can even get a deadlock just because of combination of lock and other synchronization primitives. There is also a well-known idea: over-synchronization is always bad. Some inquirers here asked some question about there solution where they synchronized threads so heavily that they made them completely sequential! Always synchronize exactly as much as needed.
Now, I can offer you two solutions I published here at CodeProject, both very close to your approach but made more accurately. First is a wrapper for the thread (which is I think is a must: using a "bare" thread is bad by many reasons I explain in my solution); another one is generic class for a blocking queue which you can transparently use between threads without any other synchronization primitives.
See:
How to pass ref parameter to the thread[
^] (thread wrapper),
change paramters of thread (producer) after it started[
^] (thread wrapper example with lock),
Simple Blocking Queue for Thread Communication and Inter-thread Invocation[
^].
Good luck,
—SA