Beispiel #1
0
// This copies the queue onto a calendar with nnewsize buckets. The new bucket
// array is on the opposite end of the array a[QSPACE] from the original        EH?!?!?!?!?!
static void resize(int newsize) {
	double bwidth;
	int i;
	int oldnbuckets;
	calqueue_node **oldcalendar, *temp, *temp2;

	if(!resize_enabled)
		return;

	// Find new bucket width
	bwidth = new_width();

	// Save location and size of old calendar for use when copying calendar
	oldcalendar = calendar;
	oldnbuckets = nbuckets;

	// Init the new calendar
	if(firstsub == 0) {
		localinit(CALQSPACE - newsize, newsize, bwidth, lastprio);
	} else {
		localinit(0, newsize, bwidth, lastprio);
	}

	// Copy elements to the new calendar
	for(i = oldnbuckets - 1; i >= 0; --i) {
		temp = oldcalendar[i];
		while(temp != NULL) {
			calqueue_put(temp->timestamp, temp->payload);
			temp2 = temp->next;
			free(temp);
			temp = temp2;
		}
	}
}
Beispiel #2
0
		/**@brief 初始化local设置一次*/
		char const* localinitonce()
		{
			static char const* p;
			if (p)return p;
			static  std::mutex mt;
			mt.lock();
			if (!p) {
				p = localinit();
			}
			mt.unlock();
			return p;
		}
Beispiel #3
0
/* xlinit - xlisp initialization routine */
void xlinit(void)
{
    /* initialize xlisp (must be in this order) */
    xlminit();	/* initialize xldmem.c */
    xldinit();	/* initialize xldbug.c */

    /* finish initializing */
#ifdef SAVERESTORE
    if (!xlirestore("xlisp.wks"))
#endif
	{
        initwks();
	}
    /* note: localinit creates type descriptors, but these
       may be necessary for xlirestore to work.  On the other
       hand, localinit creates atoms, so it needs obarray to
       be in place, and obarray is created by initwks.  We may
       have a circular dependency to break before xlirestore
       will work
     */
    localinit();	 /* initialize lisp extensions */ 
}
Beispiel #4
0
// This function initializes the messaging queue.
void calqueue_init(void) {

	localinit(0, 2, 1.0, 0.0);
	resize_enabled = true;
	pthread_spin_init(&cal_spinlock, 0);
}
Beispiel #5
0
// This function initializes the messaging queue.
void calqueue_init(void) {

	localinit(0, 2, 1.0, 0.0);
	resize_enabled = true;
}