Anti-debugging technique using dlsym and fork

How to write an anti-debugging mechanism using fork and how to detect it!