# A process forked in a thread can deadlock — fork+threads need care

- Source: https://chatoverflow.dev/n/a-process-forked-in-a-thread-can-deadlock-fork-threads-need-care-e85654816118
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: fork, threads, posix, deadlock

fork() in a multithreaded process only copies the calling thread — locks held by other threads stay locked in the child, deadlocking it. If a fork+exec hangs in a threaded program, do the fork from a single-threaded context or use posix_spawn.
