I always handle deadlocks through an application so do not know any way of handling them in SQL.
You may want to try something like the following terrible looking fiddle to see if you can avoid
deadloacks completely.
DELETE G
FROM dbo.cglobal G WITH (XLOCK READPAST)
WHERE NOT EXISTS (
SELECT *
FROM dbo.cdata D WITH (NOLOCK)
WHERE D.cfid = G.cfid
)
If deadlocks cannot be avoided the only options I can think of are either writing a small
application to handle the while loop or working out what is causing the contention on dbo.cglobal.