4,437
社区成员
发帖
与我相关
我的任务
分享
void test_thread1()
{
printk(KERN_ALERT"thread1 begin\n");
while(nCount <= 100)
{
spin_lock( &my_spinlock );
nCount++;
schedule_timeout((100)* HZ / 1000);
printk(KERN_ALERT"Hello,driver,now thread1 nCount=%d\n",nCount);
spin_unlock( &my_spinlock );
}
}
void test_thread2()
{
printk(KERN_ALERT"thread2 begin\n");
while(nCount <= 100)
{
spin_lock( &my_spinlock );
nCount++;
schedule_timeout((100)* HZ / 1000);
printk(KERN_ALERT"Hello,driver,now thread2 nCount=%d\n",nCount);
spin_unlock( &my_spinlock );
}
}