ossp-pkg/pth/pth_attr.c 1.17 -> 1.18
--- pth_attr.c 2002/10/24 15:21:13 1.17
+++ pth_attr.c 2002/11/03 11:15:04 1.18
@@ -37,6 +37,7 @@
struct pth_attr_st {
pth_t a_tid;
int a_prio;
+ int a_dispatches;
char a_name[PTH_TCB_NAMELEN];
int a_joinable;
unsigned int a_cancelstate;
@@ -85,6 +86,7 @@
return pth_error(FALSE, EPERM);
a->a_prio = PTH_PRIO_STD;
pth_util_cpystrn(a->a_name, "unknown", PTH_TCB_NAMELEN);
+ a->a_dispatches = 0;
a->a_joinable = TRUE;
a->a_cancelstate = PTH_CANCEL_DEFAULT;
a->a_stacksize = 64*1024;
@@ -149,6 +151,19 @@
}
break;
}
+ case PTH_ATTR_DISPATCHES: {
+ /* incremented on every context switch */
+ int val, *src, *dst;
+ if (cmd == PTH_ATTR_SET) {
+ src = &val; val = va_arg(ap, int);
+ dst = (a->a_tid != NULL ? &a->a_tid->dispatches : &a->a_dispatches);
+ }
+ else {
+ src = (a->a_tid != NULL ? &a->a_tid->dispatches : &a->a_dispatches);
+ dst = va_arg(ap, int *);
+ }
+ *dst = *src;
+ }
case PTH_ATTR_JOINABLE: {
/* detachment type */
int val, *src, *dst;
|
|