1 /* This test is designed to test byte memory information.  */
2 
3 #include   <stdio.h>
4 #include   "tx_api.h"
5 #include   "tx_byte_pool.h"
6 
7 
8 /* Define the ISR dispatch.  */
9 
10 extern VOID    (*test_isr_dispatch)(void);
11 
12 
13 /* Define the external reference for the preempt disable flag.  */
14 
15 extern volatile UINT   _tx_thread_preempt_disable;
16 
17 
18 static unsigned long   thread_0_counter =  0;
19 static TX_THREAD       thread_0;
20 
21 static unsigned long   thread_1_counter =  0;
22 static TX_THREAD       thread_1;
23 
24 static unsigned long   thread_2_counter =  0;
25 static TX_THREAD       thread_2;
26 
27 static unsigned long   thread_3_counter =  0;
28 static TX_THREAD       thread_3;
29 
30 static unsigned long   thread_4_counter =  0;
31 static TX_THREAD       thread_4;
32 
33 static unsigned long   thread_5_counter =  0;
34 static TX_THREAD       thread_5;
35 
36 static unsigned long   thread_6_counter =  0;
37 static TX_THREAD       thread_6;
38 
39 static TX_BYTE_POOL    byte_pool_0;
40 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
41 static TX_BYTE_POOL    byte_pool_1;
42 #endif
43 static TX_BYTE_POOL    byte_pool_2;
44 
45 static int             test_status;
46 
47 
48 /* Define thread prototypes.  */
49 
50 static void    thread_0_entry(ULONG thread_input);
51 static void    thread_1_entry(ULONG thread_input);
52 static void    thread_2_entry(ULONG thread_input);
53 static void    thread_3_entry(ULONG thread_input);
54 static void    thread_4_entry(ULONG thread_input);
55 static void    thread_5_entry(ULONG thread_input);
56 static void    thread_6_entry(ULONG thread_input);
57 
58 UINT  _tx_byte_pool_performance_info_get(TX_BYTE_POOL *pool_ptr, ULONG *allocates, ULONG *releases,
59                     ULONG *fragments_searched, ULONG *merges, ULONG *splits, ULONG *suspensions, ULONG *timeouts);
60 
61 
62 /* Prototype for test control return.  */
63 void  test_control_return(UINT status);
64 
65 
66 /* Define the ISR dispatch routine.  */
67 
test_isr(void)68 static void    test_isr(void)
69 {
70 
71     /* Determine if the test case we are looking for is present.  */
72     if ((_tx_thread_preempt_disable) && (test_status == 1))
73     {
74 
75         /* Abort the wait of thread 3.  */
76         tx_thread_wait_abort(&thread_3);
77 
78         /* End the ISR processing.  */
79         test_status =  2;
80         test_isr_dispatch =  TX_NULL;
81     }
82 }
83 
84 
85 /* Define what the initial system looks like.  */
86 
87 #ifdef CTEST
test_application_define(void * first_unused_memory)88 void test_application_define(void *first_unused_memory)
89 #else
90 void    threadx_byte_memory_information_application_define(void *first_unused_memory)
91 #endif
92 {
93 
94 UINT    status;
95 CHAR    *pointer;
96 
97 
98     /* Put first available memory address into a character pointer.  */
99     pointer =  (CHAR *) first_unused_memory;
100 
101     /* Put system definition stuff in here, e.g. thread creates and other assorted
102        create information.  */
103 
104     status =  tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1,
105             pointer, TEST_STACK_SIZE_PRINTF,
106             17, 17, 100, TX_AUTO_START);
107     pointer = pointer + TEST_STACK_SIZE_PRINTF;
108 
109     /* Check for status.  */
110     if (status != TX_SUCCESS)
111     {
112 
113         printf("Running Byte Memory Information Test................................ ERROR #1\n");
114         test_control_return(1);
115     }
116 
117     status =  tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1,
118             pointer, TEST_STACK_SIZE_PRINTF,
119             16, 16, 100, TX_DONT_START);
120     pointer = pointer + TEST_STACK_SIZE_PRINTF;
121 
122     /* Check for status.  */
123     if (status != TX_SUCCESS)
124     {
125 
126         printf("Running Byte Memory Information Test................................ ERROR #2\n");
127         test_control_return(1);
128     }
129 
130     status =  tx_thread_create(&thread_2, "thread 2", thread_2_entry, 2,
131             pointer, TEST_STACK_SIZE_PRINTF,
132             15, 15, 100, TX_DONT_START);
133     pointer = pointer + TEST_STACK_SIZE_PRINTF;
134 
135     /* Check for status.  */
136     if (status != TX_SUCCESS)
137     {
138 
139         printf("Running Byte Memory Information Test................................ ERROR #3\n");
140         test_control_return(1);
141     }
142 
143     status =  tx_thread_create(&thread_3, "thread 3", thread_3_entry, 3,
144             pointer, TEST_STACK_SIZE_PRINTF,
145             3, 3, 100, TX_DONT_START);
146     pointer = pointer + TEST_STACK_SIZE_PRINTF;
147 
148     /* Check for status.  */
149     if (status != TX_SUCCESS)
150     {
151 
152         printf("Running Byte Memory Information Test................................ ERROR #4\n");
153         test_control_return(1);
154     }
155 
156     status =  tx_thread_create(&thread_4, "thread 4", thread_4_entry, 4,
157             pointer, TEST_STACK_SIZE_PRINTF,
158             4, 4, 100, TX_DONT_START);
159     pointer = pointer + TEST_STACK_SIZE_PRINTF;
160 
161     /* Check for status.  */
162     if (status != TX_SUCCESS)
163     {
164 
165         printf("Running Byte Memory Information Test................................ ERROR #5\n");
166         test_control_return(1);
167     }
168 
169     status =  tx_thread_create(&thread_5, "thread 5", thread_5_entry, 5,
170             pointer, TEST_STACK_SIZE_PRINTF,
171             5, 5, 100, TX_DONT_START);
172     pointer = pointer + TEST_STACK_SIZE_PRINTF;
173 
174     /* Check for status.  */
175     if (status != TX_SUCCESS)
176     {
177 
178         printf("Running Byte Memory Information Test................................ ERROR #6\n");
179         test_control_return(1);
180     }
181 
182     status =  tx_thread_create(&thread_6, "thread 6", thread_6_entry, 6,
183             pointer, TEST_STACK_SIZE_PRINTF,
184             6, 6, 100, TX_DONT_START);
185     pointer = pointer + TEST_STACK_SIZE_PRINTF;
186 
187     /* Check for status.  */
188     if (status != TX_SUCCESS)
189     {
190 
191         printf("Running Byte Memory Information Test................................ ERROR #7\n");
192         test_control_return(1);
193     }
194 
195     /* Create the byte_pool with one byte.  */
196     status =  tx_byte_pool_create(&byte_pool_0, "byte_pool 0", pointer, 100);
197     pointer = pointer + 100;
198 
199     /* Check for status.  */
200     if (status != TX_SUCCESS)
201     {
202 
203         printf("Running Byte Memory Information Test................................ ERROR #8\n");
204         test_control_return(1);
205     }
206 }
207 
208 
209 
210 /* Define the test threads.  */
211 
thread_0_entry(ULONG thread_input)212 static void    thread_0_entry(ULONG thread_input)
213 {
214 
215 UINT            status;
216 VOID            *pointer;
217 CHAR            *name;
218 ULONG           available;
219 ULONG           fragments;
220 TX_THREAD       *first_suspended;
221 ULONG           suspended_count;
222 TX_BYTE_POOL    *next_pool;
223 ULONG           allocates;
224 ULONG           releases;
225 ULONG           fragments_searched;
226 ULONG           merges;
227 ULONG           splits;
228 ULONG           suspensions;
229 ULONG           timeouts;
230 
231 
232     /* Inform user.  */
233     printf("Running Byte Memory Information Test................................ ");
234 
235     /* Allocate the one byte.  */
236     tx_byte_allocate(&byte_pool_0, &pointer, 80, TX_NO_WAIT);
237 
238     /* Nothing to do here, but check prioritization with no suspended threads.  */
239     status =  tx_byte_pool_prioritize(&byte_pool_0);
240 
241     /* Check status and make sure thread 1 is terminated.  */
242     if (status != TX_SUCCESS)
243     {
244 
245         /* Byte Pool error.  */
246         printf("ERROR #9\n");
247         test_control_return(1);
248     }
249 
250     tx_thread_resume(&thread_1);
251     tx_thread_resume(&thread_2);
252 
253     /* Increment the thread counter.  */
254     thread_0_counter++;
255 
256     /* Make sure thread 1 and 2 are suspended on the byte_pool.  */
257     if ((thread_1.tx_thread_state != TX_BYTE_MEMORY) || (thread_2.tx_thread_state != TX_BYTE_MEMORY) ||
258         (byte_pool_0.tx_byte_pool_suspension_list != &thread_1))
259     {
260 
261         /* Byte Pool error.  */
262         printf("ERROR #10\n");
263         test_control_return(1);
264     }
265 
266     /* Prioritize the byte pool suspension list.  */
267     status =  tx_byte_pool_prioritize(&byte_pool_0);
268 
269     /* Check status and make sure thread 2 is now at the front of the suspension list.  */
270     if ((status != TX_SUCCESS) || (byte_pool_0.tx_byte_pool_suspension_list != &thread_2))
271     {
272 
273         /* Byte Pool error.  */
274         printf("ERROR #11\n");
275         test_control_return(1);
276     }
277 
278     /* At this point we are going to get more than 2 threads suspended.  */
279     tx_thread_resume(&thread_1);
280     tx_thread_resume(&thread_2);
281     tx_thread_resume(&thread_3);
282     tx_thread_resume(&thread_4);
283     tx_thread_resume(&thread_5);
284     tx_thread_resume(&thread_6);
285 
286     /* Prioritize the byte pool suspension list.  */
287     status =  tx_byte_pool_prioritize(&byte_pool_0);
288 
289     /* Check status and make sure thread 3 is now at the front of the suspension list.  */
290     if ((status != TX_SUCCESS) || (byte_pool_0.tx_byte_pool_suspension_list != &thread_3))
291     {
292 
293         /* Byte Pool error.  */
294         printf("ERROR #12\n");
295         test_control_return(1);
296     }
297 
298     /* Now loop to test the interrupt of the prioritize loop logic.  */
299     test_status =  1;
300     test_isr_dispatch =  test_isr;
301     do
302     {
303 
304         /* Prioritize the byte pool suspension list.  */
305         status =  tx_byte_pool_prioritize(&byte_pool_0);
306 
307         /* Check status and make sure thread 1 is terminated.  */
308         if (status != TX_SUCCESS)
309         {
310 
311             /* Byte Pool error.  */
312             printf("ERROR #13\n");
313             test_control_return(1);
314         }
315 
316     } while (test_status == 1);
317 
318     /* Check status and make sure thread 3 is now at the front of the suspension list.  */
319     if ((status != TX_SUCCESS) || (byte_pool_0.tx_byte_pool_suspension_list != &thread_4))
320     {
321 
322         /* Byte Pool error.  */
323         printf("ERROR #14\n");
324         test_control_return(1);
325     }
326 
327 #ifndef TX_DISABLE_ERROR_CHECKING
328 
329     /* Call byte pool info with a NULL pointer.  */
330     status =  tx_byte_pool_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
331 
332     /* Check for error.  */
333     if (status != TX_POOL_ERROR)
334     {
335 
336         /* Byte Pool error.  */
337         printf("ERROR #15\n");
338         test_control_return(1);
339     }
340 
341     /* Call byte pool info with an non-created pool pointer.  */
342     byte_pool_2.tx_byte_pool_id =  0;
343     status =  tx_byte_pool_info_get(&byte_pool_2, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
344 
345     /* Check for error.  */
346     if (status != TX_POOL_ERROR)
347     {
348 
349         /* Byte Pool error.  */
350         printf("ERROR #16\n");
351         test_control_return(1);
352     }
353 #endif
354 
355     /* Get the byte pool information.   */
356     status =  tx_byte_pool_info_get(&byte_pool_0, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
357     status += tx_byte_pool_info_get(&byte_pool_0, &name, &available, &fragments, &first_suspended, &suspended_count, &next_pool);
358 
359     /* Check the status.  */
360     if ((status != TX_SUCCESS) || (available != byte_pool_0.tx_byte_pool_available) || (fragments != byte_pool_0.tx_byte_pool_fragments) ||
361         (first_suspended != &thread_4) || (suspended_count != byte_pool_0.tx_byte_pool_suspended_count) || (next_pool != &byte_pool_0))
362     {
363 
364         /* Byte Pool error.  */
365         printf("ERROR #17\n");
366         test_control_return(1);
367     }
368 
369 
370 #ifdef TX_BYTE_POOL_ENABLE_PERFORMANCE_INFO
371 
372     /* Get the byte pool performance information.  */
373     status =  tx_byte_pool_performance_info_get(TX_NULL, &allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
374 
375     /* Check the status.  */
376     if (status != TX_PTR_ERROR)
377     {
378 
379         /* Byte Pool error.  */
380         printf("ERROR #18\n");
381         test_control_return(1);
382     }
383 
384     /* Get the byte pool performance information.  */
385     status =  tx_byte_pool_performance_info_get(&byte_pool_1, &allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
386 
387     /* Check the status.  */
388     if (status != TX_PTR_ERROR)
389     {
390 
391         /* Byte Pool error.  */
392         printf("ERROR #19\n");
393         test_control_return(1);
394     }
395 
396     /* Get the byte pool performance information.  */
397     status =  tx_byte_pool_performance_info_get(&byte_pool_0, &allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
398 
399     /* Check the status.  */
400     if ((status != TX_SUCCESS) || (allocates != byte_pool_0.tx_byte_pool_performance_allocate_count) || (releases != byte_pool_0.tx_byte_pool_performance_release_count) ||
401         (fragments_searched != byte_pool_0.tx_byte_pool_performance_search_count) || (merges != byte_pool_0.tx_byte_pool_performance_merge_count) ||
402         (splits != byte_pool_0.tx_byte_pool_performance_split_count) || (suspensions != byte_pool_0.tx_byte_pool_performance_suspension_count) ||
403         (timeouts != byte_pool_0.tx_byte_pool_performance_timeout_count))
404     {
405 
406         /* Byte Pool error.  */
407         printf("ERROR #20\n");
408         test_control_return(1);
409     }
410 
411     /* Get the byte pool system performance information.  */
412     status =  tx_byte_pool_performance_system_info_get(&allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
413 
414     /* Check the status.  */
415     if ((status != TX_SUCCESS) || (allocates != _tx_byte_pool_performance_allocate_count) || (releases != _tx_byte_pool_performance_release_count) ||
416         (fragments_searched != _tx_byte_pool_performance_search_count) || (merges != _tx_byte_pool_performance_merge_count) ||
417         (splits != _tx_byte_pool_performance_split_count) || (suspensions != _tx_byte_pool_performance_suspension_count) ||
418         (timeouts != _tx_byte_pool_performance_timeout_count))
419     {
420 
421         /* Byte Pool error.  */
422         printf("ERROR #21\n");
423         test_control_return(1);
424     }
425     else
426     {
427 
428         /* Successful test.  */
429         printf("SUCCESS!\n");
430         test_control_return(0);
431     }
432 #else
433 
434     /* Get the byte pool performance information.  */
435     status =  tx_byte_pool_performance_info_get(&byte_pool_0, &allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
436 
437     /* Check the status.  */
438     if (status != TX_FEATURE_NOT_ENABLED)
439     {
440 
441         /* Byte Pool error.  */
442         printf("ERROR #22\n");
443         test_control_return(1);
444     }
445 
446     /* Get the byte pool performance information.  */
447     status =  tx_byte_pool_performance_info_get(TX_NULL, &allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
448 
449     /* Check the status.  */
450     if (status != TX_FEATURE_NOT_ENABLED)
451     {
452 
453         /* Byte Pool error.  */
454         printf("ERROR #23\n");
455         test_control_return(1);
456     }
457 
458     /* Get the byte pool performance information.  */
459     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
460 
461     /* Check the status.  */
462     if (status != TX_FEATURE_NOT_ENABLED)
463     {
464 
465         /* Byte Pool error.  */
466         printf("ERROR #24\n");
467         test_control_return(1);
468     }
469 
470     /* Get the byte pool performance information.  */
471     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
472 
473     /* Check the status.  */
474     if (status != TX_FEATURE_NOT_ENABLED)
475     {
476 
477         /* Byte Pool error.  */
478         printf("ERROR #25\n");
479         test_control_return(1);
480     }
481 
482     /* Get the byte pool performance information.  */
483     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &merges, &splits, &suspensions, &timeouts);
484 
485     /* Check the status.  */
486     if (status != TX_FEATURE_NOT_ENABLED)
487     {
488 
489         /* Byte Pool error.  */
490         printf("ERROR #26\n");
491         test_control_return(1);
492     }
493 
494     /* Get the byte pool performance information.  */
495     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &splits, &suspensions, &timeouts);
496 
497     /* Check the status.  */
498     if (status != TX_FEATURE_NOT_ENABLED)
499     {
500 
501         /* Byte Pool error.  */
502         printf("ERROR #27\n");
503         test_control_return(1);
504     }
505 
506     /* Get the byte pool performance information.  */
507     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &suspensions, &timeouts);
508 
509     /* Check the status.  */
510     if (status != TX_FEATURE_NOT_ENABLED)
511     {
512 
513         /* Byte Pool error.  */
514         printf("ERROR #28\n");
515         test_control_return(1);
516     }
517 
518     /* Get the byte pool performance information.  */
519     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &timeouts);
520 
521     /* Check the status.  */
522     if (status != TX_FEATURE_NOT_ENABLED)
523     {
524 
525         /* Byte Pool error.  */
526         printf("ERROR #29\n");
527         test_control_return(1);
528     }
529 
530     /* Get the byte pool performance information.  */
531     status =  tx_byte_pool_performance_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
532 
533     /* Check the status.  */
534     if (status != TX_FEATURE_NOT_ENABLED)
535     {
536 
537         /* Byte Pool error.  */
538         printf("ERROR #30\n");
539         test_control_return(1);
540     }
541 
542     /* Get the byte pool system performance information.  */
543     status =  tx_byte_pool_performance_system_info_get(&allocates, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
544 
545     /* Check the status.  */
546     if (status != TX_FEATURE_NOT_ENABLED)
547     {
548 
549         /* Byte Pool error.  */
550         printf("ERROR #31\n");
551         test_control_return(1);
552     }
553 
554     /* Get the byte pool system performance information.  */
555     status =  tx_byte_pool_performance_system_info_get(TX_NULL, &releases, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
556 
557     /* Check the status.  */
558     if (status != TX_FEATURE_NOT_ENABLED)
559     {
560 
561         /* Byte Pool error.  */
562         printf("ERROR #32\n");
563         test_control_return(1);
564     }
565 
566     /* Get the byte pool system performance information.  */
567     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, &fragments_searched, &merges, &splits, &suspensions, &timeouts);
568 
569     /* Check the status.  */
570     if (status != TX_FEATURE_NOT_ENABLED)
571     {
572 
573         /* Byte Pool error.  */
574         printf("ERROR #33\n");
575         test_control_return(1);
576     }
577 
578     /* Get the byte pool system performance information.  */
579     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, &merges, &splits, &suspensions, &timeouts);
580 
581     /* Check the status.  */
582     if (status != TX_FEATURE_NOT_ENABLED)
583     {
584 
585         /* Byte Pool error.  */
586         printf("ERROR #34\n");
587         test_control_return(1);
588     }
589 
590     /* Get the byte pool system performance information.  */
591     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, &splits, &suspensions, &timeouts);
592 
593     /* Check the status.  */
594     if (status != TX_FEATURE_NOT_ENABLED)
595     {
596 
597         /* Byte Pool error.  */
598         printf("ERROR #35\n");
599         test_control_return(1);
600     }
601 
602     /* Get the byte pool system performance information.  */
603     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &suspensions, &timeouts);
604 
605     /* Check the status.  */
606     if (status != TX_FEATURE_NOT_ENABLED)
607     {
608 
609         /* Byte Pool error.  */
610         printf("ERROR #36\n");
611         test_control_return(1);
612     }
613 
614     /* Get the byte pool system performance information.  */
615     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, &timeouts);
616 
617     /* Check the status.  */
618     if (status != TX_FEATURE_NOT_ENABLED)
619     {
620 
621         /* Byte Pool error.  */
622         printf("ERROR #37\n");
623         test_control_return(1);
624     }
625 
626     /* Get the byte pool system performance information.  */
627     status =  tx_byte_pool_performance_system_info_get(TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL, TX_NULL);
628 
629     /* Check the status.  */
630     if (status != TX_FEATURE_NOT_ENABLED)
631     {
632 
633         /* Byte Pool error.  */
634         printf("ERROR #38\n");
635         test_control_return(1);
636     }
637 
638     /* Successful test.  */
639     printf("SUCCESS!\n");
640     test_control_return(0);
641 #endif
642 }
643 
644 
thread_1_entry(ULONG thread_input)645 static void    thread_1_entry(ULONG thread_input)
646 {
647 UINT    status;
648 VOID    *pointer;
649 
650     /* Loop forever!  */
651     while(1)
652     {
653 
654 
655         /* Get byte from pool.  */
656         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
657 
658         if (status != TX_SUCCESS)
659             break;
660 
661         /* Increment the thread counter.  */
662         thread_1_counter++;
663     }
664 }
665 
666 
thread_2_entry(ULONG thread_input)667 static void    thread_2_entry(ULONG thread_input)
668 {
669 
670 UINT    status;
671 VOID    *pointer;
672 
673 
674     /* Loop forever!  */
675     while(1)
676     {
677 
678 
679         /* Get byte from pool.  */
680         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
681 
682         if (status != TX_SUCCESS)
683             break;
684 
685         /* Increment the thread counter.  */
686         thread_2_counter++;
687     }
688 }
689 
690 
thread_3_entry(ULONG thread_input)691 static void    thread_3_entry(ULONG thread_input)
692 {
693 
694 UINT    status;
695 VOID    *pointer;
696 
697 
698     /* Loop forever!  */
699     while(1)
700     {
701 
702 
703         /* Get byte from pool.  */
704         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
705 
706         if (status != TX_SUCCESS)
707             break;
708 
709         /* Increment the thread counter.  */
710         thread_3_counter++;
711     }
712 }
713 
714 
thread_4_entry(ULONG thread_input)715 static void    thread_4_entry(ULONG thread_input)
716 {
717 
718 UINT    status;
719 VOID    *pointer;
720 
721 
722     /* Loop forever!  */
723     while(1)
724     {
725 
726 
727         /* Get byte from pool.  */
728         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
729 
730         if (status != TX_SUCCESS)
731             break;
732 
733         /* Increment the thread counter.  */
734         thread_4_counter++;
735     }
736 }
737 
738 
thread_5_entry(ULONG thread_input)739 static void    thread_5_entry(ULONG thread_input)
740 {
741 
742 UINT    status;
743 VOID    *pointer;
744 
745 
746     /* Loop forever!  */
747     while(1)
748     {
749 
750 
751         /* Get byte from pool.  */
752         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
753 
754         if (status != TX_SUCCESS)
755             break;
756 
757         /* Increment the thread counter.  */
758         thread_5_counter++;
759     }
760 }
761 
762 
thread_6_entry(ULONG thread_input)763 static void    thread_6_entry(ULONG thread_input)
764 {
765 
766 UINT    status;
767 VOID    *pointer;
768 
769 
770     /* Loop forever!  */
771     while(1)
772     {
773 
774 
775         /* Get byte from pool.  */
776         status =  tx_byte_allocate(&byte_pool_0, &pointer, 25, TX_WAIT_FOREVER);
777 
778         if (status != TX_SUCCESS)
779             break;
780 
781         /* Increment the thread counter.  */
782         thread_6_counter++;
783     }
784 }
785