[Bug 21350] New: SSF Sega Saturn Emulator displays "SetThreadAffinityMask() error" dialog box

wine-bugs at winehq.org wine-bugs at winehq.org
Wed Jan 13 05:58:20 CST 2010


http://bugs.winehq.org/show_bug.cgi?id=21350

           Summary: SSF Sega Saturn Emulator displays
                    "SetThreadAffinityMask() error" dialog box
           Product: Wine
           Version: 1.1.36
          Platform: x86
               URL: http://www7a.biglobe.ne.jp/~phantasy/ssf/files/SSF_011
                    _alpha_R2.zip
        OS/Version: Linux
            Status: NEW
          Keywords: download
          Severity: normal
          Priority: P2
         Component: -unknown
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: arethusa26 at gmail.com


With wine-1.1.36-37-gdbd7657, launching SSF.exe results in the main window
being displayed, with a subsequent error dialog box being shown:

"SetThreadAffinityMask() error.
 File : ./main.cpp
 Line : 1222
 Function : WinMain"

The expected behavior, in the case of no available CD media, is for the
application to simply close after showing the main window. A +relay log shows:

0009:Call
KERNEL32.CreateThread(00000000,00100000,004149f0,00000000,00000004,0033cc28)
ret=0040c891
0009:Ret  KERNEL32.CreateThread() retval=00000068 ret=0040c891
0009:Call KERNEL32.SetThreadAffinityMask(00000068,00000001) ret=0040c8d5
0009:Ret  KERNEL32.SetThreadAffinityMask() retval=00000000 ret=0040c8d5
0009:Call KERNEL32.GetLastError() ret=00623a82
0009:Ret  KERNEL32.GetLastError() retval=00000005 ret=00623a82

When I trace +server I see:

0009: new_thread( access=001f03ff, attributes=00000000, suspend=1,
request_fd=17 )
0009: new_thread() = 0 { tid=001b, handle=0068 }
0009: get_thread_info( handle=0068, tid_in=0000 )
0009: get_thread_info() = 0 { pid=0008, tid=001b, teb=00000000,
affinity=ffffffffffffffff, creation_time=1ca9445a829cb12 (-0.0001510),
exit_time=0, exit_code=259, priority=0, last=0 }
0009: set_thread_info( handle=0068, mask=2, priority=0, affinity=00000001,
token=0000 )
0009: set_thread_info() = ACCESS_DENIED

which all happens before:

001b: *fd* 19 <- 34
001b: *fd* 21 <- 35
001b: init_thread( unix_pid=21045, unix_tid=21068, debug_level=1, teb=7ffd4000,
entry=004149f0, reply_fd=19, wait_fd=21, cpu=x86 )
...

The return code seems to come from (set_thread_affinity() in server/thread.c):

#ifdef HAVE_SCHED_SETAFFINITY
    if (thread->unix_tid != -1)
    {
        /* ... */
    }
    else set_error( STATUS_ACCESS_DENIED );
#else
    /* ...*/

My guess is that somehow there is an attempt to set the thread affinity for the
suspended thread that happens before the thread data (unix_tid) is fully
initialized. If I add a Sleep(1000) statement in SetThreadAffinityMask, the
problem seems to vanish.

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list