Click here to Skip to main content
15,898,373 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Error message Pin
David Crow2-Mar-09 3:06
David Crow2-Mar-09 3:06 
GeneralRe: Error message Pin
vanishaa2-Mar-09 3:13
vanishaa2-Mar-09 3:13 
GeneralRe: Error message Pin
David Crow2-Mar-09 3:16
David Crow2-Mar-09 3:16 
GeneralRe: Error message Pin
vanishaa2-Mar-09 3:28
vanishaa2-Mar-09 3:28 
GeneralRe: Error message Pin
David Crow2-Mar-09 3:31
David Crow2-Mar-09 3:31 
Questionparellel mutithread problem Pin
JackPuppy2-Mar-09 1:53
JackPuppy2-Mar-09 1:53 
AnswerRe: parellel mutithread problem Pin
Code-o-mat2-Mar-09 2:15
Code-o-mat2-Mar-09 2:15 
GeneralRe: parellel mutithread problem Pin
JackPuppy2-Mar-09 2:31
JackPuppy2-Mar-09 2:31 
sorry, when i extrat my code i forget to change some words:
here is the right one and I have release the semaphore in each thread, right in front of "return", and I know the queuing policy is better but I just want to find out what's wrong with my program,by the way at the same time there can only be 10 threads because of my semaphore controling policy.see"//"


main(){

....Handle hCont=CreateFile(....);
hSema=CREATESemaphore(0,1,1,0);
hSemaThr=CREATEMUTEX(0,10,10,0);//so there are only 10 threads at most in the same time
WHILE(regex_search(begin,end,stringmatch,r)){
string s=stringmatch[0];
begin=stringmatch[0].second;


WaitForSingleObject(hSemaThr,INFINITE);
CreateThread(0,0,Grab,(void*)dc,0,0);

}

CloseHandle(hCont);
}

void Grab(void* doc){

......
......

WaitForSingleObject(hSema,INFINITE);
if(!WriteFile(::hCont,lpBuf,(int)strlen(lpBuf),&lpN,0)){
cout < <"can't write file in thread" < <GetLastError() < <endl;
//system("pause");

}
ReleaseSemaphore(hSema,1,0);


ReleaseSemaphore(hSemaThr,1,0);

return;

}
GeneralRe: parellel mutithread problem Pin
Code-o-mat2-Mar-09 2:36
Code-o-mat2-Mar-09 2:36 
Questionhow to include a paneld inside the client area in SDI architect? Pin
Joseph Marzbani2-Mar-09 1:25
Joseph Marzbani2-Mar-09 1:25 
AnswerRe: how to include a paneld inside the client area in SDI architect? Pin
Stuart Dootson2-Mar-09 3:32
professionalStuart Dootson2-Mar-09 3:32 
GeneralRe: how to include a paneld inside the client area in SDI architect? Pin
Joseph Marzbani2-Mar-09 6:59
Joseph Marzbani2-Mar-09 6:59 
QuestionHow C++ read one digit each time from a sequence of digits? Pin
followait2-Mar-09 0:28
followait2-Mar-09 0:28 
AnswerRe: How C++ read one digit each time from a sequence of digits? Pin
_AnsHUMAN_ 2-Mar-09 0:37
_AnsHUMAN_ 2-Mar-09 0:37 
GeneralRe: How C++ read one digit each time from a sequence of digits? Pin
followait2-Mar-09 0:38
followait2-Mar-09 0:38 
GeneralRe: How C++ read one digit each time from a sequence of digits? Pin
_AnsHUMAN_ 2-Mar-09 0:48
_AnsHUMAN_ 2-Mar-09 0:48 
GeneralRe: How C++ read one digit each time from a sequence of digits? Pin
followait2-Mar-09 0:57
followait2-Mar-09 0:57 
AnswerRe: How C++ read one digit each time from a sequence of digits? Pin
David Crow2-Mar-09 3:48
David Crow2-Mar-09 3:48 
QuestionRemote COM Pin
RevathiRamakumar2-Mar-09 0:14
RevathiRamakumar2-Mar-09 0:14 
AnswerRe: Remote COM Pin
CPallini2-Mar-09 0:26
mveCPallini2-Mar-09 0:26 
GeneralRe: Remote COM Pin
RevathiRamakumar2-Mar-09 0:29
RevathiRamakumar2-Mar-09 0:29 
QuestionRe: Remote COM Pin
CPallini2-Mar-09 0:34
mveCPallini2-Mar-09 0:34 
AnswerRe: Remote COM Pin
RevathiRamakumar2-Mar-09 0:42
RevathiRamakumar2-Mar-09 0:42 
QuestionRe: Remote COM Pin
CPallini2-Mar-09 0:55
mveCPallini2-Mar-09 0:55 
AnswerRe: Remote COM Pin
RevathiRamakumar2-Mar-09 1:02
RevathiRamakumar2-Mar-09 1:02 

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.