Hey there. I have this project due in 3 days and I just cant seem to find the answer anywhere. I have to simulate the reader and writer problem. I do have the code but when it comes to the semaphore it does not seem that my IDE has the semaphore library file. Im using visual basic 2008. Can you guys plz help me. Also, the Professor asked that we use at switch statement to randomly choose threads to execute. I thought I got it but it does not work. Here is the code I have for switch statement with random number generator.
int lowest=1, highest=2;
for(int index=0; index<20; index++)
random_integer = lowest+int(range*rand()/(RAND_MAX + 1.0));
case 1 : DWORD WINAPI READER1(LPVOID r);
case 2 : DWORD WINAPI WRITER1(LPVOID n);