main()
{	char str[80];
	thread_t ctid;

	/* create the thread counter subroutine */
	thr_create(NULL, 0, counter, 0, THR_NEW_LWP|THR_DETACHED, &ctid);

	while(1) {
	        gets(str);
	        thr_suspend(ctid);
	
	        mutex_lock(&count_lock);
	        printf("\n\nCOUNT = %d\n\n", count);
	        mutex_unlock(&count_lock);
	
	        thr_continue(ctid);
        }

	return(0);
}
Exemple #2
0
 static inline void ccxx_suspend(cctid_t tid) { thr_suspend((thread_t)tid); }