Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CheckSynchonize called from non-main thread

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3384

PostPosted: Fri May 08, 2026 11:26 am    Post subject: CheckSynchonize called from non-main thread Reply with quote

This is the code I have at the top of an AA script:
Code:
[ENABLE]
{$lua}
if syntaxcheck then return end
if process == nil then ShowMessage('Process is not selected.')
elseif readInteger(process) == 0 then ShowMessage('Process cannot be opened. Gone?')
else
  if (monopipe~=nil) and (monopipe.ProcessID~=getOpenedProcessID()) then
    monopipe.destroy()
    monopipe=nil
  end
  if (monopipe==nil) then
    LaunchMonoDataCollector()
    -- monoSymbolList is only available if the target is il2cpp and not normal mono
    while (monoSymbolList==nil) or (not monoSymbolList.FullyLoaded) do checkSynchronize(50) end -- checkSynchronize requires that memRec is ASynch.
  end
end
{$asm}

The memrec with script is set to 'Execute asynchronous".
When I execute the script, I get this error:
Code:
<<CheckSynchonize called from non-main thread "$9F0">>


Any suggestions?

Thank you!
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 474

Joined: 09 May 2003
Posts: 25929
Location: The netherlands

PostPosted: Fri May 08, 2026 12:14 pm    Post subject: This post has 1 review(s) Reply with quote

Quote:

checkSynchronize requires that memRec is ASynch.

That is wrong. checkSynchronize may never be called inside an async thread

Code:

while (monoSymbolList==nil) or (not monoSymbolList.FullyLoaded) do
  if inMainThread() then
    checkSynchronize(50)
  else
    sleep(50)
  end
end

_________________
Tools give you results. Knowledge gives you control.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3384

PostPosted: Fri May 08, 2026 3:34 pm    Post subject: Reply with quote

Dark Byte wrote:
...


Seems I misinterpreted something.
Works great, thank you!
Thank you!
Back to top
View user's profile Send private message
Csimbi
I post too much
Reputation: 98

Joined: 14 Jul 2007
Posts: 3384

PostPosted: Mon May 11, 2026 5:14 am    Post subject: Reply with quote

There must be a bug here.
When I disable the script and I enable it a second time (mono is active on IL2CPP), I get this error:
Code:
<<Lua error in the script at line 8:...\CEBETA\autorun\monoscript.lua:53: attempt to call a nil value (global 'synchronze')>>
If, after this, I try to enable it a third time, CE starts flooding the LUA log with this message (and CE must be killed to stop this):
Code:
Error:Access violation


The second line in this snippet is line 53 in monoscript.lua:
Code:
    if inMainThread()==false then
      synchronze(function()
        messageDialog(translate('Do not call libmono.terminate from external threads'), mtError, mbOK)
      end)
    end


Is there a typo here with the 'i' missing?
Searched all files - the string 'synchronze' was not found anywhere else.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites