public function sessionCommit($cb = null)
    {
        if (!$this->sessionFp || $this->sessionFlushing) {
            if ($cb) {
                $cb(false);
            }
            return;
        }
        $this->sessionFlushing = true;
        $data = $this->sessionEncode();
        $l = mb_orig_strlen($data);
        $cb = CallbackWrapper::wrap($cb);
        $this->sessionFp->write($data, function ($file, $result) use ($l, $cb) {
            $file->truncate($l, function ($file, $result) use ($cb) {
                $this->sessionFlushing = false;
                if ($cb) {
                    $cb(true);
                }
            });
        });
    }