Urabe Shyouhei さんは書きました: > Tanaka Akira さんは書きました: >> In article <49D308AD.4040303 / ruby-lang.org>, >> Urabe Shyouhei <shyouhei / ruby-lang.org> writes: >> >>> ちょっとこの「Pthreadの仕様的にも動作保障外」って部分の根拠がどうがんばっても自 >>> 力で発見できないので、よろしければ何かポインタを示していただけませんか? >> fork の項にある >> >> Consequently, to avoid errors, the child process may only >> execute async-signal-safe operations until such time as >> one of the exec functions is called. >> >> http://www.opengroup.org/onlinepubs/009695399/functions/fork.html >> >> というところなんじゃないかと思います。 >> >> async-signal-safe function のリストは >> http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html >> に載っていて、pthread_create は入っていません。 >> >> なので、規格としては、fork でできた子プロセスでは exec する >> まで pthread_create を使ってはいけません。 > > なるほど。ありがとうございます。 しかしするとpthread_atforkのRATIONALEにある「forkの前にmutexを確保してfork後に 開放する」ってやつはそもそも無理なんですねえ。pthread_mutex_unlockもasync- signal-safeではないようですし。