Changeset 7100108 in rtems-libbsd
- Timestamp:
- 04/17/14 07:45:42 (9 years ago)
- Branches:
- 4.11, 5, 5-freebsd-12, 6-freebsd-12, freebsd-9.3, master
- Children:
- b6d5758
- Parents:
- 9219a29
- git-author:
- Sebastian Huber <sebastian.huber@…> (04/17/14 07:45:42)
- git-committer:
- Sebastian Huber <sebastian.huber@…> (05/14/14 07:11:37)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
testsuite/thread01/test_main.c
r9219a29 r7100108 1 1 /* 2 * Copyright (c) 2013 embedded brains GmbH. All rights reserved.2 * Copyright (c) 2013-2014 embedded brains GmbH. All rights reserved. 3 3 * 4 4 * embedded brains GmbH … … 31 31 32 32 #include <machine/rtems-bsd-kernel-space.h> 33 #include <machine/rtems-bsd-thread.h> 33 34 34 35 #include <stdlib.h> … … 209 210 { 210 211 rtems_resource_snapshot snapshot; 211 uintptr_t take_away;212 212 void *greedy; 213 uintptr_t take_away = 2 * BSD_MINIMUM_TASK_STACK_SIZE; 213 214 214 215 puts("test kthread_add()"); 215 216 216 greedy = rtems_workspace_greedy_allocate _all_except_largest(&take_away);217 greedy = rtems_workspace_greedy_allocate(&take_away, 1); 217 218 218 219 rtems_resource_snapshot_take(&snapshot); … … 221 222 222 223 while (take_away > 0) { 223 struct thread *td = NULL;224 224 void *away; 225 int eno; 226 227 /* 228 * FIXME: This direct workspace access is a hack to get 229 * reasonable test run times with RTEMS_DEBUG enabled. 230 */ 231 _Thread_Disable_dispatch(); 232 away = _Workspace_Allocate(take_away); 233 _Thread_Enable_dispatch(); 234 235 eno = kthread_add( 236 test_kthread_add_thread, 237 TEST_KTHREAD_ADD, 238 NULL, 239 &td, 240 0, 241 0, 242 "%s", 243 &test_kthread_name[0] 244 ); 245 246 _Thread_Disable_dispatch(); 247 _Workspace_Free(away); 248 _Thread_Enable_dispatch(); 249 250 if (eno == 0) { 251 wait_for_worker_thread(); 252 assert(td != NULL); 253 254 take_away = 0; 255 } else { 256 assert(eno == ENOMEM); 257 assert(rtems_resource_snapshot_check(&snapshot)); 258 259 --take_away; 225 bool ok; 226 227 ok = rtems_workspace_allocate(take_away, &away); 228 if (ok) { 229 struct thread *td = NULL; 230 int eno; 231 232 eno = kthread_add( 233 test_kthread_add_thread, 234 TEST_KTHREAD_ADD, 235 NULL, 236 &td, 237 0, 238 0, 239 "%s", 240 &test_kthread_name[0] 241 ); 242 243 ok = rtems_workspace_free(away); 244 assert(ok); 245 246 if (eno == 0) { 247 wait_for_worker_thread(); 248 assert(td != NULL); 249 250 break; 251 } else { 252 assert(eno == ENOMEM); 253 assert(rtems_resource_snapshot_check(&snapshot)); 254 } 260 255 } 256 257 --take_away; 261 258 } 259 260 assert(take_away > 0); 262 261 263 262 rtems_workspace_greedy_free(greedy);
Note: See TracChangeset
for help on using the changeset viewer.