>
>
>Version?
>
RTLinux 3.1, kernel 2.2.19
>What context is pthread_create called in?
>
kernel-kontext, not from RT threads
>Code ?
>
It's a wrapper function, here are the parts that are relevant; the
s_Tasks array is used to keep track of things internally, and the code
I'm playing around at the moment calls that function three times. I get
the same handle for s_Tasks entry 0 and 1 - which causes trouble later on.
unsigned long SysTaskCreate(char* szTaskName, unsigned char byPriority,
unsigned long ulInterval, void *pFunction, void *pArgument)
{
int iTask, max_priority;
pthread_attr_t attr;
struct sched_param sched_param;
hrtime_t period;
for (iTask = 0; iTask < MAX_TASKS; iTask++)
if (s_Tasks[iTask].sysInfo.ulHandle == 0)
break;
if (iTask >= MAX_TASKS)
return TASKID_INVALID;
[...]
pthread_attr_init (&attr);
pthread_attr_setfp_np (&attr, 1);
max_priority = sched_get_priority_max(SCHED_FIFO);
sched_param.sched_priority = (max_priority-1000) - byPriority;
pthread_attr_setschedparam(&attr, &sched_param);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); /*
this should be changed to joinable (then tasks should be joined) for SMP
systems */
if (pthread_create((pthread_t*)&s_Tasks[iTask].sysInfo.ulHandle,
&attr, pFunction, pArgument) != 0)
return TASKID_INVALID;
period = ulInterval*1000000;
pthread_make_periodic_np((pthread_t)s_Tasks[iTask].sysInfo.ulHandle,
gethrtime(), period);
pthread_attr_destroy(&attr);
s_iTasks++;
printk(KERN_INFO "SysTaskCreate: TaskName = %s, TaskNr = %d,
TaskHandle = %ld\n", szTaskName, iTask, s_Tasks[iTask].sysInfo.ulHandle);
return iTask;
}
cu & thanks
Daniel
--
3S-Smart Software Solutions GmbH
Fischerstr.19, D-87435 Kempten
Tel. ++49-(0)831-54031-72
Fax ++49-(0)831-54031-50
email: [EMAIL PROTECTED]
web: http://www.3s-software.com
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/