0

I'm trying to setup a multithread linked list. I think I have the initial list setup properly. As it says in the title of my post, I can't figure out how to get access to the nodes in the list to add the second thread. Here is the code that I have so far.

void List::setListByName(Winery& winePlace){
    Node * node = new Node;
    Node * curr = headName->nextName;
    Node * prior = headName;
    node->vineyard = winePlace;
    node->nextName = NULL;
    char newWine[CHAR_SIZE] = "Hi";
    char currWine[CHAR_SIZE] = "Hi";
    winePlace.getWineryName(newWine);
    while(curr != tailName){
        curr->vineyard.getWineryName(currWine);
        if(strcmp(currWine, newWine) < 0){
            prior = curr;
            curr = curr->nextName;
        }
        else{
            break;
        }
    }
    prior->nextName = node;
    node->nextName = curr;    
}

void List::qualityScoreSort(List& list){
    Node* curr = headScore->nextRating;
    Node* previous = headScore;
    while(curr != tailScore){
        previous->nextRating = list.Node;//?????
        list.Node.//????
    }
}
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Napalm6b
  • 23
  • 5
  • What exactly is a "multithreaded linked list"? I guess you're in the same course as this person: http://stackoverflow.com/questions/26321779/deep-copy-without-overloaded-operator – John Zwinck Oct 12 '14 at 04:11
  • a multithreaded linked list uses multiple sets of pointers to traverse the list based on different object data members. It can just be used for sorting purposes. – Napalm6b Oct 12 '14 at 04:36
  • Is what you mean that you want to sort of overlay two linked lists on the same data values? That is, sort of like a regular linked list but with an extra set of pointers on all the nodes so you can traverse in multiple different orderings? If so, that is not what most people would call "multithreaded." :) – John Zwinck Oct 12 '14 at 08:50
  • Could you please add the class definitions either? (Node & List) – Géza Török Oct 12 '14 at 08:59

0 Answers0