Click here to Skip to main content
15,912,069 members
Home / Discussions / Algorithms
   

Algorithms

 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
riced19-Feb-11 0:51
riced19-Feb-11 0:51 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Brady Kelly19-Feb-11 1:55
Brady Kelly19-Feb-11 1:55 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Yusuf19-Feb-11 2:05
Yusuf19-Feb-11 2:05 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Brady Kelly19-Feb-11 2:17
Brady Kelly19-Feb-11 2:17 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Roger Wright19-Feb-11 4:35
professionalRoger Wright19-Feb-11 4:35 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Brady Kelly19-Feb-11 4:40
Brady Kelly19-Feb-11 4:40 
GeneralRe: Basic Aging Algorithm for Insurance Premiums Pin
Roger Wright19-Feb-11 5:25
professionalRoger Wright19-Feb-11 5:25 
QuestionThreading problem Pin
Anthony Mushrow15-Feb-11 6:50
professionalAnthony Mushrow15-Feb-11 6:50 
I'm a little tired of staring at these few lines and not seeing the problem. Take this code:

volatile int WorkingBuff = 0;
volatile int NextBuff = 1;
volatile int RenderBuff = 1;

//Thread A
void stuff()
{
  NextBuff = WorkingBuff;
  int usedId = 0;
  do
  {
    usedId = RenderBuff;
    for(int i=0; i<3; i++)
    {
      if(i != NextBuff && i != usedId)
        WorkingBuff = i;
    }
  } while(RenderBuff != usedId);
}

//Thread B
void render()
{
  RenderBuff = NextBuff;
  //do stuff with RenderBuff
}


Could anybody point out the situation where WorkingBuff and RenderBuff have the same value? I'm just not seeing it.
My current favourite phrase: I've seen better!
-SK Genius

Source Indexing and Symbol Servers

AnswerRe: Threading problem Pin
Alan Balkany15-Feb-11 7:17
Alan Balkany15-Feb-11 7:17 
GeneralRe: Threading problem Pin
Anthony Mushrow15-Feb-11 7:36
professionalAnthony Mushrow15-Feb-11 7:36 
GeneralRe: Threading problem Pin
Alan Balkany15-Feb-11 7:41
Alan Balkany15-Feb-11 7:41 
GeneralRe: Threading problem Pin
Anthony Mushrow15-Feb-11 7:49
professionalAnthony Mushrow15-Feb-11 7:49 
GeneralRe: Threading problem Pin
Alan Balkany15-Feb-11 8:07
Alan Balkany15-Feb-11 8:07 
GeneralRe: Threading problem Pin
Anthony Mushrow15-Feb-11 8:21
professionalAnthony Mushrow15-Feb-11 8:21 
GeneralRe: Threading problem Pin
Luc Pattyn15-Feb-11 8:57
sitebuilderLuc Pattyn15-Feb-11 8:57 
GeneralRe: Threading problem Pin
JesperMadsen12321-Feb-11 10:09
JesperMadsen12321-Feb-11 10:09 
AnswerRe: Threading problem Pin
Luc Pattyn15-Feb-11 7:57
sitebuilderLuc Pattyn15-Feb-11 7:57 
GeneralRe: Threading problem Pin
Anthony Mushrow15-Feb-11 8:10
professionalAnthony Mushrow15-Feb-11 8:10 
QuestionMerging sorted data blocks. Pin
Member 419459313-Feb-11 16:59
Member 419459313-Feb-11 16:59 
AnswerRe: Merging sorted data blocks. Pin
Luc Pattyn14-Feb-11 1:15
sitebuilderLuc Pattyn14-Feb-11 1:15 
AnswerRe: Merging sorted data blocks. Pin
Member 419459314-Feb-11 4:00
Member 419459314-Feb-11 4:00 
GeneralRe: Merging sorted data blocks. Pin
Stefan_Lang14-Feb-11 23:25
Stefan_Lang14-Feb-11 23:25 
GeneralRe: Merging sorted data blocks. Pin
Member 419459315-Feb-11 4:41
Member 419459315-Feb-11 4:41 
GeneralRe: Merging sorted data blocks. Pin
Stefan_Lang15-Feb-11 5:31
Stefan_Lang15-Feb-11 5:31 
GeneralRe: Merging sorted data blocks. Pin
Member 419459315-Feb-11 7:30
Member 419459315-Feb-11 7:30 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.