Database/server.c
void thread_cleanup(void *arg) {
    // TODO: Remove the client object from thread list and call
    // client_destructor. This function must be thread safe! The client must
    // be in the list before this routine is ever run.
	pthread_mutex_lock (&thread_list_mutex);
    
	client_t* client = (client_t*)arg;
    if(client == thread_list_head) {
		thread_list_head = client->next;
		thread_list_head->prev = NULL;
	}
	else {
		client->prev->next = client->next;
		client->next->prev = client->prev;
	}
    pthread_mutex_unlock (&thread_list_mutex);
    
	client_destructor(client);
}
// Cleanup routine for client threads, called on cancels and exit.
Cleanup routine for client threads, called on cancels and exit.
Cleanup routine for client threads called on cancels and exit .
void thread_cleanup(void *arg) {
	pthread_mutex_lock (&thread_list_mutex);
	client_t* client = (client_t*)arg;
    if(client == thread_list_head) {
		thread_list_head = client->next;
		thread_list_head->prev = NULL;
	}
	else {
		client->prev->next = client->next;
		client->next->prev = client->prev;
	}
    pthread_mutex_unlock (&thread_list_mutex);
	client_destructor(client);
}
void thread_cleanup ( void * arg ) { pthread_mutex_lock ( & thread_list_mutex ) ; client_t * client = ( client_t * ) arg ; if ( client == thread_list_head ) { thread_list_head = client -> next ; thread_list_head -> prev = NULL ; } else { client -> prev -> next = client -> next ; client -> next -> prev = client -> prev ; } pthread_mutex_unlock ( & thread_list_mutex ) ; client_destructor ( client ) ; }
Cleanup routine for client threads, called on cancels and exit.
Cleanup routine for client threads called on cancels and exit .
// TODO: Remove the client object from thread list and call // client_destructor. This function must be thread safe! The client must // be in the list before this routine is ever run.