protothread icon indicating copy to clipboard operation
protothread copied to clipboard

Add API pthread_atexit()

Open TragicWarrior opened this issue 6 years ago • 1 comments

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.

TragicWarrior avatar Nov 08 '19 16:11 TragicWarrior

@LarryRuane , I'll submit a pull request for this. let me know if you do not like this idea.

TragicWarrior avatar Nov 08 '19 16:11 TragicWarrior