Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. extern size_t __default_stacksize;
  2. extern size_t __default_guardsize;
  3.  
  4. int pthread_setattr_default_np(const pthread_attr_t *attrp)
  5. {
  6. /* Reject anything in the attr object other than stack/guard size. */
  7. pthread_attr_t tmp = *attrp, zero = { 0 };
  8. tmp._a_stacksize = 0;
  9. tmp._a_guardsize = 0;
  10. if (memcmp(&tmp, &zero, sizeof tmp))
  11. return EINVAL;
  12.  
  13. __inhibit_ptc();
  14. if (attrp->_a_stacksize >= __default_stacksize)
  15. __default_stacksize = attrp->_a_stacksize;
  16. if (attrp->_a_guardsize >= __default_guardsize)
  17. __default_guardsize = attrp->_a_guardsize;
  18. __release_ptc();
  19.  
  20. int pthread_getattr_default_np(pthread_attr_t *attrp)
  21. {
  22. __acquire_ptc();
  23. *attrp = (pthread_attr_t) {
  24. ._a_stacksize = __default_stacksize,
  25. ._a_guardsize = __default_guardsize,
  26. };
  27. __release_ptc();
  28. return 0;
  29. }
  30. return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement