Example Active Object (Cont.) Here is an implementation of one of the active object's "public" functions: void del_file(file_handler_t fh, const char* file_path) { /* allocate command object and fill it. */ struct cmd* cmd = (struct cmd*)malloc(sizeof(struct cmd)); cmd->cmd = CMD_TYPE_DEL; cmd->u.del_data.filepath = (char*)malloc(strlen(file_path)+1); strcpy(cmd->u.del_data.filepath, file_path); /* add command to queue, and notify internal thread. */ pthread_mutex_lock(&fh->q->mutex); q_insert(fh->q, cmd); pthread_cond_signal(&fh->q->cond); pthread_mutex_unlock(&fh->q->mutex); }