Make sched_football use the create_fifo_thread() library function instead
of an open-coded implementation.
Signed-off-by: Sebastien Dugue <[EMAIL PROTECTED]>
Acked-by: Darren Hart <[EMAIL PROTECTED]>
Cc: Tim Chavez <[EMAIL PROTECTED]>
---
.../realtime/func/sched_football/sched_football.c | 25 +------------------
1 files changed, 2 insertions(+), 23 deletions(-)
diff --git a/testcases/realtime/func/sched_football/sched_football.c
b/testcases/realtime/func/sched_football/sched_football.c
index 9c43fca..49dc16a 100644
--- a/testcases/realtime/func/sched_football/sched_football.c
+++ b/testcases/realtime/func/sched_football/sched_football.c
@@ -157,27 +157,6 @@ int referee(int game_length)
return final_ball != 0;
}
-
-void create_thread_(void*(*func)(void*), int prio)
-{
- pthread_t thread;
- pthread_attr_t attr;
- struct sched_param param;
-
- param.sched_priority = sched_get_priority_min(SCHED_FIFO) + prio;
-
- pthread_attr_init(&attr);
- pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED);
- pthread_attr_setschedparam(&attr, ¶m);
- pthread_attr_setschedpolicy(&attr, SCHED_FIFO);
-
- if (pthread_create(&thread, &attr, func, (void *)0)) {
- perror("pthread_create failed");
- }
-
- pthread_attr_destroy(&attr);
-}
-
int main(int argc, char* argv[])
{
struct sched_param param;
@@ -220,7 +199,7 @@ int main(int argc, char* argv[])
printf("Starting %d offense threads at priority %d\n",
players_per_team, priority);
for (i = 0; i < players_per_team; i++)
- create_thread_(thread_offense, priority);
+ create_fifo_thread(thread_offense, NULL, priority);
while (offense_count < players_per_team)
usleep(100);
@@ -229,7 +208,7 @@ int main(int argc, char* argv[])
printf("Starting %d defense threads at priority %d\n",
players_per_team, priority);
for (i = 0; i < players_per_team; i++)
- create_thread_(thread_defense, priority);
+ create_fifo_thread(thread_defense, NULL, priority);
while (defense_count < players_per_team)
usleep(100);
--
1.5.4.rc2.84.gf85fd-dirty
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list