Home > OS >  Pthread_attr_setstack usage
Pthread_attr_setstack usage

Time:10-15

Using pthread_attr_setstack, create threads, results pthread_getattr_np wrong, where is the problem?

CodePudding user response:

Pthread_getattr_np is unique to the GNU API, not to displacement, please use the posix standard interface,
Don't have direct access to pthread_attr_t structure, set and get all have the corresponding API

 
# include & lt; Pthread. H>

Int pthread_attr_destroy (pthread_attr_t * attr);
Int pthread_attr_init (pthread_attr_t * attr);

Int pthread_attr_getstack (const pthread_attr_t * restrict attr,
Void * * restrict stackaddr, size_t * restrict stacksize);
Int pthread_attr_setstack (pthread_attr_t * attr, void * stackaddr,
Size_t stacksize);
  • Related