Created
February 17, 2011 03:40
-
-
Save galonsky/830922 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "thread.h" | |
#include "interrupt.h" | |
#include <iostream> | |
using namespace std; | |
void thread2(void *arg) | |
{ | |
char *lotsa_memory = new char[STACK_SIZE * 1000]; | |
thread_lock(123); | |
thread_wait(123, 1); | |
thread_unlock(123); | |
} | |
void thread(void *arg) | |
{ | |
start_preemptions(true, false, 0); | |
for(int i = 0; i < 10000000; i++) | |
{ | |
thread_create((thread_startfunc_t) thread2, (void *) 0); | |
if(i % 10000 == 0) | |
{ | |
thread_broadcast(123, 1); | |
} | |
} | |
} | |
int main() | |
{ | |
if(thread_libinit((thread_startfunc_t) thread, (void *) 0) == -1) | |
{ | |
cout << "Failure" << endl; | |
} | |
else | |
{ | |
cout << "Success" << endl; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment