struct Pool* createPool() {
struct Pool* pool = malloc (sizeof (struct Pool));
// TODO
pool->lock = uthread_sem_create(1);
pool->count_from_empty = uthread_sem_create(0);
pool->count_from_full = uthread_sem_create(MAX_ITEMS);
pool->items = 0;
return pool;
}
How can I call createPool() in the main function?
Is it like that?
int main (int argc, char** argv) {
struct Pool* p = createPool();
......}
Last edited on