Hi Michael!
I've got a problem: I've got a program that calls pthread_create()
(i.e.) three times, and the first to calls return the same handle!
Kernel 2.2.19, RTLinux 3.1
all calls to pthread_create() happen in kernel space, here's the code,
although it's nothing fancy
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);
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;
}
Any ideas?
cu & thanks
Daniel
-- [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/