1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/*
* (C) Finite State Machine Labs Inc. 2000 business@fsmlabs.com
*
* Released under the terms of GPL 2.
* Open RTLinux makes use of a patented process described in
* US Patent 5,995,745. Use of this process is governed
* by the Open RTLinux Patent License which can be obtained from
* www.fsmlabs.com/PATENT or by sending email to
* licensequestions@fsmlabs.com
*/
#include <rtl_sync.h>
#include <rtl.h>
#include <time.h>
#include <pthread.h>
#include <rtl_debug.h>
pthread_t thread = 0;
void *start_routine(void *arg)
{
int *p;
struct sched_param my_sparam;
my_sparam.sched_priority = 1;
rtl_printf("pthread_self() %016lx\n", pthread_self());
pthread_setschedparam(pthread_self(), SCHED_FIFO, &my_sparam);
pthread_make_periodic_np(pthread_self(),
clock_gethrtime(CLOCK_REALTIME),
NSECS_PER_SEC / 4);
pthread_wait_np();
pthread_wait_np();
pthread_wait_np();
pthread_wait_np();
pthread_wait_np();
pthread_wait_np();
p = 0;
*p = 1;
return p;
}
int init_module(void)
{
return pthread_create(&thread, NULL, start_routine, (void *) 1);
}
void cleanup_module(void)
{
pthread_delete_np(thread);
}
|