protothread
protothread copied to clipboard
Add API pthread_atexit()
When a protothread is terminated via pt_kill, and after the protothread is unlinked from the run queue, the protothreads system should optionally invoke a user defined callback if set. Recommended prototype for function:
pt_atexit(void (*atexit)(void *env))
The rationale here is to give the user a graceful way of tearing down any context related storage including deallocing the env itself.
@LarryRuane , I'll submit a pull request for this. let me know if you do not like this idea.