Cell: clean-up cell_spu_exit() code

This commit is contained in:
Brian 2008-01-10 09:13:10 -07:00
parent e6b33b6f35
commit d07b86dedf
3 changed files with 8 additions and 22 deletions

View file

@ -148,7 +148,6 @@ cell_destroy_context( struct pipe_context *pipe )
struct cell_context *cell = cell_context(pipe);
cell_spu_exit(cell);
wait_spus(cell->num_spus);
free(cell);
}
@ -255,7 +254,6 @@ cell_create_context(struct pipe_winsys *winsys, struct cell_winsys *cws)
#if 0
test_spus(cell);
wait_spus();
#endif
return &cell->pipe;

View file

@ -194,32 +194,23 @@ test_spus(struct cell_context *cell)
}
/**
* Wait for all SPUs to exit/return.
*/
void
wait_spus(uint num_spus)
{
uint i;
void *value;
for (i = 0; i < num_spus; i++) {
pthread_join(cell_global.spe_threads[i], &value);
}
}
/**
* Tell all the SPUs to stop/exit.
*/
void
cell_spu_exit(struct cell_context *cell)
{
unsigned i;
uint i;
for (i = 0; i < cell->num_spus; i++) {
send_mbox_message(cell_global.spe_contexts[i], CELL_CMD_EXIT);
}
wait_spus(cell->num_spus);
/* wait for threads to exit */
for (i = 0; i < cell->num_spus; i++) {
void *value;
pthread_join(cell_global.spe_threads[i], &value);
cell_global.spe_threads[i] = 0;
cell_global.spe_contexts[i] = 0;
}
}

View file

@ -82,9 +82,6 @@ void
test_spus(struct cell_context *cell);
void
wait_spus(uint num_spus);
void
cell_spu_exit(struct cell_context *cell);