yield equivalent in C/JavaScript?

Bjorn Pettersen BPettersen at NAREX.com
Sat Jun 29 14:41:29 EDT 2002

> From: Robin Becker [mailto:robin at jessikat.fsnet.co.uk] 
> Is there any way to do yielding easily in C? I have a bunch 
> of programs which are normally connected together using unix 
> pipes. I would like to merge them and the problem is then how 
> to get them to communicate nicely using a single process.

Using threads, you can simulate yield by having the yielding thread
blocking until the thread calling it tells it to restart. This is rather
obscure however, so I wouldn't suggest that you do it. If you are going
to use threads, I would suggest using a Queue to communicate
work/results (I can send you our C++ version of Python's Queue.Queue()
implementation if that would help...)

-- bjorn

More information about the Python-list mailing list