comment_post callback function: how to run it in the background.

If you’re sending a redirect, then you can also just close the connection early and continue processing.

wp_safe_redirect('http://example.com');
header("Content-Length: 0");
header("Connection: close");
flush();
do_something(); // continue processing whatever, user is already redirecting by now

Reference: http://www.php.net/manual/en/features.connection-handling.php#104541

Read those user comments carefully, there’s some caveats there.