How to wait for a thread to end?

Dear riot developers,

while writing tests I want to wait for a thread I created to end. I tried something with changing my own priority but it did not work.

How can I wait for a thread to end?

Thank you in advance.

Cheers, Julian

Hi,

not 100% sure if this can be done generally (apart from the state checks it should AFAICS), but have a look how the pthread implementation how it implements pthread_join() [1] which is essentially what you are trying to do (see pthread_join(3)).

Cheers, Martine

[1] https://github.com/RIOT-OS/RIOT/blob/7eb579bf4f921d5246d4dccc80b48c8f2f307d06/sys/posix/pthread/pthread.c#L223-L255