source: rtems/testsuites/psxtests/psxkey01/init.c @ b5c9064

4.115
Last change on this file since b5c9064 was b5c9064, checked in by Zhongwei Yao <ashi08104@…>, on Aug 5, 2013 at 1:20:45 PM

Unlimited objects support for POSIX keys

This patch enables unlimited model in POSIX key manger and have a decent
runtime on POSIX key searching, adding and deleting operations. Memory
overhead is lower than current implementation when the size of key and key
value becomes big.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/*
2 *  COPYRIGHT (c) 1989-2012.
3 *  On-Line Applications Research Corporation (OAR).
4 *
5 *  The license and distribution terms for this file may be
6 *  found in the file LICENSE in this distribution or at
7 *  http://www.rtems.com/license/LICENSE.
8 */
9
10#ifdef HAVE_CONFIG_H
11#include "config.h"
12#endif
13
14#define CONFIGURE_INIT
15#include "system.h"
16#include <errno.h>
17#include "tmacros.h"
18
19/* forward declarations to avoid warnings */
20void *POSIX_Init(void *argument);
21void Key_destructor(void *key_data);
22
23void Key_destructor(void *key_data)
24{
25}
26
27void *POSIX_Init(
28  void *argument
29)
30{
31  int    status;
32
33  puts( "\n\n*** POSIX KEY 01 TEST ***" );
34
35  /* set the time of day, and print our buffer in multiple ways */
36
37  set_time( TM_FRIDAY, TM_MAY, 24, 96, 11, 5, 0 );
38
39  /* get id of this thread */
40
41  Init_id = pthread_self();
42  printf( "Init's ID is 0x%08" PRIxpthread_t "\n", Init_id );
43
44  rtems_workspace_greedy_allocate( NULL, 0 );
45
46  puts("Init: pthread_key_create - OK");
47  empty_line();
48  status = pthread_key_create( &Key_id[0], Key_destructor );
49  fatal_directive_check_status_only( status, 0, "OK" );
50
51  puts( "*** END OF POSIX KEY 01 TEST ***" );
52  rtems_test_exit( 0 );
53
54  return NULL; /* just so the compiler thinks we returned something */
55}
Note: See TracBrowser for help on using the repository browser.