An update of my findings:
There is a task SsgPeriodTask which runs all the time, every 20ms or so. It is probably related to frame rate of live view. Then, when the shooting starts, there are basically two possible sequences of task switching. The used sequence depends on the phase of SsgPeriodTask.
The most common sequence:
0000 ISComTask the log starts at the point in CaptSeqTask where the sync code used to be
0000 CaptSeqTask
0000 ISComTask ISComTask and CaptSeqTask both have low prio
0000 CaptSeqTask
0000 ISComTask
0000 CaptSeqTask
0000 _ImageSensorTask high prio task starts here, triggered by CaptSeqTask
0000 SsgMainTask
0000 _ImageSensorTask
0000 SsgMainTask
0000 SsgPeriodTask
0000 SsgMainTask
U1 I moved the sync code here, attached to TgTask
U0
0000 TgTask
0010 SsgMainTask
0020 _ImageSensorTask <- When I tried to put sync code before this, I got completely black photos
0020 CaptSeqTask back to low prio tasks, the high prio tasks probably waits for something
0020 PhySw
0020 ISMainTask
0020 ISComTask
0020 ISMainTask
0020 ShutterSoundTask
0020 ISComTask
0020 ShutterSoundTask
0020 ISComTask
0020 ShutterSoundTask
0020 ISComTask
0020 ShutterSoundTask
0020 ISComTask
0020 ShutterSoundTask
0020 CtrlSrv
0020 ISComTask
0020 CtrlSrv
0020 ISComTask
0020 CtrlSrv
0020 ISComTask
0020 CtrlSrv
0020 SsgPeriodTask high prio tasks run again, the capture happens somewhere here
0020 SsgMainTask
0020 SynchTask
0020 MechaShutter end of capture
The less common sequence, ~10% of shots
0000 ISComTask the log starts at the point in CaptSeqTask where the sync code used to be
0000 CaptSeqTask
0000 ISComTask
0000 CaptSeqTask
0000 ISComTask
0000 CaptSeqTask
0000 ISComTask
0000 CaptSeqTask
0000 SsgPeriodTask this seems to be an extra switch to SsgPeriodTask, not triggered by CaptSeqTask
0000 CaptSeqTask
0010 _ImageSensorTask this is high prio task triggered by CaptSeqTask but the order is different
0010 SsgMainTask
0010 _ImageSensorTask
0010 CaptSeqTask low prio tasks runs earlier
0010 PhySw
0010 SsgPeriodTask
0010 PhySw
0010 ShutterSoundTask
0010 CtrlSrv
0010 SsgPeriodTask
0010 CtrlSrv
0010 SsgMainTask
0010 SsgPeriodTask
0010 SsgMainTask
U1 sync on TgTask
U0
0010 TgTask
0020 SsgMainTask
0020 _ImageSensorTask
0020 SsgPeriodTask
0020 _ImageSensorTask capture happens somewhere here
0020 SsgMainTask
0020 SynchTask
0020 MechaShutter end of capture
I think that it should be possible to synchronize the start of shooting with SsgPeriodTask to get always the same sequence, but I don't have reliable results yet.