« イメージマジック imagemagick 変換できる画像の種類の一覧 | HOME | ffsys ffsrvmod カーネルモジュール »

カーネルスレッド

struct task_struct *kthread_create(int (*threadfn)(void *data), void *data, const char namefmt[], ...)
引数1 スレッド関数を指定
引数2 渡す引数
引数3 psで表示される名前


static int test_thread(void * num)
{
  //thread処理
}

static int __init init_test(void){ //threadを生成する初期化モジュール
  struct task_struct *th;
  //省略

  //thread生成
  th = kthread_create(test_thread, &num, "test_thread");
  if (IS_ERR(th)) {
    //失敗
    goto ERR_RET;
  }
  //threadスタート
  wake_up_process(th);
}


 

ハワイ旅行| サトピの子連れグアム旅行記| グアム旅行の情報サイト| ガーデニング|

Copyright (C) 2009 Anne Corporation. All Rights Reserved.