示例#1
0
void BoardWidget::initPieces()
{
    n2 = new Piece( *yellowColor );
    h2 = new Piece( *yellowHColor );
    d2 = new Piece( *yellowHColor, 3.14/2 );

    n1 = new Piece( *redColor );
    h1 = new Piece( *redHColor );
    d1 = new Piece( *redHColor, 3.14/2 );

    // e  = new Ball( white,0,0 );
    // e->setSpecials(.6,.85,.75);

    createBlending(1,10,h1,n1);
    createBlending(2,10,h1,d1);
    createBlending(3,10,h2,n2);
    createBlending(4,10,h2,d2);

    int i,j,pos;
    for(j=-4;j<5;j++)
	for(i= ((j>0)?j-4:-4) ; i< ((j<0)?5+j:5) ;i++) {
	    pos=60+j*11+i;
	    createPos(pos, i,j, 0);
	}

    pos = 0;
    /* the outer marks of color1 */
    for(i=0;i<3;i++) createPos(pos++, -6, i-4, 0 );
    for(i=0;i<3;i++) createPos(pos++, 2+i, i-4, 0 );

    /* the outer marks of color2 */
    for(i=0;i<3;i++) createPos(pos++, 6, 4-i, 0 );
    for(i=0;i<3;i++) createPos(pos++, -2-i, 4-i, 0 );
}  
示例#2
0
int main()
{
	pthread_t threadCore[1][1][8];
	initMpsocController(1, 1, 8);

	//Intitilization for Pthread FileIO
	f = malloc(sizeof(fileio_t));
	f->channel = calloc (FIO_CHANNEL_MAX_NUM, sizeof (*f->channel));
	assert (f->channel != NULL);
	/* XXX: this is a bad design decision since programs depend on the (at
	 * compile time unknown) channel count and are _not_portable_! */
	f->scratchpadSize = SCRATCHPAD_SIZE - FIO_CHANNEL_MAX_NUM * FIO_CHANNEL_MEM_FOOTPRINT;
	f->scratchpad = calloc (f->scratchpadSize, sizeof (*f->scratchpad));
	assert (f->scratchpad != NULL);

	pthread_key_create(&procIdX, globalDestructor);
	pthread_key_create(&procIdY, globalDestructor);
	pthread_key_create(&procIdID, globalDestructor);
	pthread_key_create(&procType, globalDestructor);
	pthread_key_create(&procDebugFile, globalDestructor);

	pthread_create(&(threadCore[0][0][0]), NULL, Start, createPos(&cpu_0_0_0, 0, 0, 0, 'P'));
	pthread_create(&(threadCore[0][0][1]), NULL, Start, createPos(&cpu_0_0_1, 0, 0, 1, 'P'));
	pthread_create(&(threadCore[0][0][2]), NULL, Start, createPos(&cpu_0_0_2, 0, 0, 2, 'P'));
	pthread_create(&(threadCore[0][0][3]), NULL, Start, createPos(&cpu_0_0_3, 0, 0, 3, 'P'));
	pthread_create(&(threadCore[0][0][4]), NULL, Start, createPos(&cpu_0_0_4, 0, 0, 4, 'P'));
	pthread_create(&(threadCore[0][0][5]), NULL, Start, createPos(&cpu_0_0_5, 0, 0, 5, 'P'));
	pthread_create(&(threadCore[0][0][6]), NULL, Start, createPos(&cpu_0_0_6, 0, 0, 6, 'P'));
	pthread_create(&(threadCore[0][0][7]), NULL, Start, createPos(&cpu_0_0_7, 0, 0, 7, 'P'));

	pthread_join(threadCore[0][0][0], NULL);
	pthread_join(threadCore[0][0][1], NULL);
	pthread_join(threadCore[0][0][2], NULL);
	pthread_join(threadCore[0][0][3], NULL);
	pthread_join(threadCore[0][0][4], NULL);
	pthread_join(threadCore[0][0][5], NULL);
	pthread_join(threadCore[0][0][6], NULL);
	pthread_join(threadCore[0][0][7], NULL);
	return 0;
}