I'm trying to use protothreading to run two different functions in paralell. But one of the functions gets stuck and doesn't let the other run.

I think the problem is that the standard way of calling a protothread function is to be a "Static int" function. So... it will return something integer, right?

One of my functions also needs to return an integer... and I think that's the problem.. since I have a return in the function.

How can I solve this situation?

Thank you, Pedro Oliveira

Your question makes no sense. Please post a program that exhibits the problem.

How are you managing to get multiple threads on a single processor? Are you using some library or something? A link to that would be most helpful because on a normal Arduino what you propose is impossible.

I'm based on this explanation I found in the web:

I already noticed that the problem went away when I stopped returning a value inside the protothread function. I have to pass the value with a pointer.

That seems like an awfully complicated way to accomplish something that is dead simple through normal code.

What sorts of things do you actually want to try to protothread? Chances are the code would be much simpler if written in a non-blocking fashion so you could just do both things at the same time.

Perhaps the demo Several Things at a Time would be of interest.