void enqueue(int item){ if(full_queue()){ printf("Full!\n"); return; } if(!full_one()) push_one(item); else{ while(!full_two() && !empty_one()) push_two(pop_one()); push_one(item); } }
static void do_push_part_1vb_yz(struct psc_fields *flds, struct psc_particles *prts) { for (int n = 0; n < prts->n_part; n++) { push_one(prts, n, flds, flds); } }
static void do_push_part_1vb_yz(struct psc_fields *flds, struct psc_particles *prts) { #ifdef PSC_PARTICLES_AS_SINGLE_BY_BLOCK struct psc_particles_single_by_block *sub = psc_particles_single_by_block(prts); #endif for (int b = 0; b < sub->nr_blocks; b++) { for (int n = sub->b_off[b]; n < sub->b_off[b+1]; n++) { push_one(prts, n, flds, flds); } } }
/*! * Inserts an element at the end of the queue * * \note If there is a thread blocked in \c pop(), this function will wake it up */ void push(const value_type& element) { boost::lock_guard<boost::mutex> lock(_mutex); push_one(element); }