int xct_t::collect( vtable_t& v, bool names_too) { int n=0; W_COERCE(acquire_xlist_mutex()); { w_list_i<xct_t, queue_based_lock_t> i(_xlist); while (i.next()) { n++; } } if(names_too) n++; // n: number of rows // xct_last: number of attributes // names_init.max_size(): maximum attribute length if(v.init(n, xct_last, names_init.max_size())) { release_xlist_mutex(); return -1; } vtable_func<xct_t> f(v); if(names_too) f.insert_names(); { w_list_i<xct_t, queue_based_lock_t> i(_xlist); while (i.next()) { f( *i.curr()); } } release_xlist_mutex(); return 0; //no error }
int xct_t::collect( vtable_t& v, bool names_too) { chkpt_serial_m::chkpt_acquire(); int n=num_active_xcts(); if(names_too) n++; // n: number of rows // xct_last: number of attributes // names_init.max_size(): maximum attribute length if(v.init(n, xct_last, names_init.max_size())) { chkpt_serial_m::chkpt_release(); return -1; } vtable_func<xct_t> f(v); if(names_too) f.insert_names(); { xct_i i; while (xct_t* xd = i.next()) { f(*xd); } } chkpt_serial_m::chkpt_release(); return 0; //no error }
int sthread_t::collect(vtable_t &v, bool names_too) { pthread_mutex_lock(&_class_list_lock); // Traverse once to count the number of entries. Grot. int nt=0; { sthread_list_i i(*_class_list); while (i.next()) { nt++; } } if(names_too) nt ++; // nt: number of rows // sthread_last: number of attributes // names_init.max_size() : max attribute length if(v.init(nt, sthread_last, names_init.max_size())) return -1; vtable_func<sthread_t> f(v); // TODO: REMOVE // cerr << "collect " << __LINE__ << " " << __FILE__; v.operator<<(cerr); cerr << endl; if(names_too) f.insert_names(); // TODO: REMOVE // cerr << "collect " << __LINE__ << " " << __FILE__; v.operator<<(cerr); cerr << endl; { sthread_list_i i(*_class_list); while (i.next()) { // Call the function f to fill a row of the table. f(*i.curr()); // TODO: REMOVE // cerr << "collect " << __LINE__ << " " << __FILE__; v.operator<<(cerr); cerr << endl; } } pthread_mutex_unlock(&_class_list_lock); return 0; // no error }
void say() { vtable->say(this); }