I am very new to C# and am writing a program that needs a Form with some controls and 2 other separate threads that run continuously and talk to each other.
this example has worked really well for me in a similar application in Python in the past and I understand it well, so I would like to bring it over to C# if possible. I am stuck at how to share the q object between the two classes. Can anyone point me in the right direction?
	
							
						
					this example has worked really well for me in a similar application in Python in the past and I understand it well, so I would like to bring it over to C# if possible. I am stuck at how to share the q object between the two classes. Can anyone point me in the right direction?
Code:
	#very over simplified and abridged Python example
q = Queue.Queue(100)
class c1:
    def __init__(self, q):
        while 1:
            do stuff and add result to queue...
            q.put("data")
class c2:
    def __init__(self, q):
        while 1:
            q.get()
            do other stuff after taking from queue...
threada = c1(q)
threadb = c2(q)
threada.start()
threadb.start()
Comment