/* * fop -- * File operation function. */ static void * fop(void *arg) { STATS *s; uintptr_t id; WT_RAND_STATE rnd; u_int i; id = (uintptr_t)arg; __wt_yield(); /* Get all the threads created. */ s = &run_stats[id]; __wt_random_init(&rnd); for (i = 0; i < nops; ++i, __wt_yield()) switch (__wt_random(&rnd) % 10) { case 0: ++s->bulk; obj_bulk(); break; case 1: ++s->create; obj_create(); break; case 2: ++s->cursor; obj_cursor(); break; case 3: ++s->drop; obj_drop(__wt_random(&rnd) & 1); break; case 4: ++s->ckpt; obj_checkpoint(); break; case 5: ++s->upgrade; obj_upgrade(); break; case 6: ++s->rebalance; obj_rebalance(); break; case 7: ++s->verify; obj_verify(); break; case 8: ++s->bulk_unique; obj_bulk_unique(__wt_random(&rnd) & 1); break; case 9: ++s->create_unique; obj_create_unique(__wt_random(&rnd) & 1); break; } return (NULL); }
void* func_get_ptr(Value v_func, int16 num_params) { obj_verify(v_func, klass_func); Func* c_data = obj_c_data(v_func); if (c_data->num_params != num_params){ exc_raise("func_get_ptr() mismatch (Function has %"PRIu16 " but called with %"PRIu16")", c_data->num_params, num_params); } return (void*) c_data->func0; }
Tuple* val_to_tuple(Value v_tuple) { obj_verify(v_tuple, klass_Tuple); return obj_c_data(v_tuple); }
Complex* val_to_complex(Value v) { obj_verify(v, klass_Complex); return obj_c_data(v); }
/* * Destroys only one object. Children of object being destroyed go to * destroyed object's parent */ int obj_destroy_one_impl(ABObj *objPtr) { #define obj (*objPtr) int return_value= 0; int iRC= 0; /* return code */ BOOL bDestroyNotifyBatched= FALSE; #ifdef DEBUG if (debugging()) { if (obj_verify(obj) < 0) { util_dprintf(0, "WARNING: Corrupt obj detected in obj_destroy (%s:d).\n", __FILE__, __LINE__); if (debug_level() >= 3) { abort(); } } /*be sure to verify if anybody accesses this now-invalid hunk o' mem*/ obj->debug_last_verify_time = 0; } #endif /* DEBUG */ if ( (obj_has_impl_flags(obj, ObjFlagDestroyed)) || (obj_has_impl_flags(obj, ObjFlagBeingDestroyed)) ) { return_value = (ERR_MULTIPLE_FREE); goto epilogue; } /* * Send notify while parents still in tact */ obj_set_impl_flags(obj, ObjFlagBeingDestroyed); /* before notifying! */ iRC= objP_notify_send_destroy(obj); bDestroyNotifyBatched= (iRC == OBJ_NOTIFY_BATCHED); /* * If the notify batched, we don't actually destroy the object * until *after* the clients have been notified */ if (bDestroyNotifyBatched) { /* * we need to make sure a name search does not find this object. */ objP_remove_from_names_list(obj); } else { return_value = objP_actually_destroy_one(obj); } /* * It's officially destroyed, at this point. It just doesn't know it, yet. * It won't show up in traversal, find_by_name(), et cetera */ if (obj != NULL) { obj_clear_impl_flags(obj, ObjFlagBeingDestroyed); obj_set_impl_flags(obj, ObjFlagDestroyed); } epilogue: obj = NULL; /* it's always set to NULL */ return return_value; #undef obj }
void func_set_vararg(Value v_func) { obj_verify(v_func, klass_func); Func* c_data = obj_c_data(v_func); c_data->var_params = 1; }