TD2 II.3 add for in threadcreate
We've got problem since thread stack are the same
This commit is contained in:
parent
feff887fa0
commit
6e0d91918a
1 changed files with 8 additions and 3 deletions
|
@ -2,8 +2,13 @@
|
|||
#include "syscall.h"
|
||||
|
||||
void f(int c) {
|
||||
/* Since our stack is shared with other threads, we've got
|
||||
* a problem here, when executing a thread there is not 8 iterations.
|
||||
* This is like synchronisation */
|
||||
volatile int i;
|
||||
for (i=0;i<8;i++){
|
||||
PutChar((char)c);
|
||||
//GetChar();
|
||||
}
|
||||
ThreadExit();
|
||||
}
|
||||
|
||||
|
@ -12,7 +17,7 @@ int main(){
|
|||
for (i=64; i < 68; i++){
|
||||
ThreadCreate(f, i);
|
||||
}
|
||||
PutString("end of main()\n");
|
||||
// PutString("end of main()\n");
|
||||
ThreadExit();
|
||||
//return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue