Example #1
0
void thread_test(){
    screenlock=bt_create_lock();
    for(size_t k=0; k<1000; ++k) {
        bt_threadhandle threads[10]={0};
        void *threadstacks[10]={0};
        for(size_t i=0; i<10; ++i) {
            threadstacks[i] = malloc(4096);
            void *stackptr = (void *) ((char *) threadstacks[i] + 4096);
            char *testparam = "TEST PARAMETER";
            threads[i] = bt_new_thread(&the_thread, (void *) testparam, stackptr);
            bt_lock(screenlock);
            printf("New thread handle: %i\n", threads[i]);
            bt_unlock(screenlock);
        }
        for(size_t i=0; i<10; ++i) {
            bt_wait_thread(threads[i]);
            free(threadstacks[i]);
        }
    }
    bt_destroy_lock(screenlock);
}
Example #2
0
	void Thread::Wait() const{
		bt_wait_thread(handle);
	}