Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: C++ Builder X3 Synchronize error


This question is answered. Helpful answers available: 1. Correct answers available: 1.


Permlink Replies: 3 - Last Post: Feb 5, 2018 3:04 AM Last Post By: Andreas Wegener
Tomasz Piotr

Posts: 4
Registered: 1/25/13
C++ Builder X3 Synchronize error  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 5, 2018 2:27 AM
Hi All,

I've been struggling with this all afternoon. My thread class is:

class TLoadingThread : public TThread
{
    protected:
        virtual void __fastcall Execute();
        void Spin(); //to be synchronized
 
    public:
        __fastcall TLoadingThread();
          void __fastcall GentleStop();
        long m_Stop;
};
My Execute method:
 
void __fastcall TLoadingThread::Execute()
{
    while (!m_Stop)
    {
        Sleep(1000);
        Synchronize(&Spin);
    }
 
    m_Stop = 0;
}

causes compiler error:

[bcc32 Error] WaitInfoWindow.cpp(59): E2285 Could not find a match for 'TThread::Synchronize(void (* (_closure )())())'
Full parser context
WaitInfoWindow.cpp(55): parsing: void _fastcall TLoadingThread::Execute()
also
Synchronize(Spin);

causes

[bcc32 Error] WaitInfoWindow.cpp(59): E2285 Could not find a match for 'TThread::Synchronize(void)'
Full parser context
WaitInfoWindow.cpp(55): parsing: void _fastcall TLoadingThread::Execute()

I read, for some only Synchronize(&Spin); works, for others both Synchronize(Spin); and Synchronize(&Spin); work too but with my none of these work. I'm using:

X3 C++ Builder Update1. Maybe it's something with compiler settings I should change?

best regards

Tomasz
Andreas Wegener

Posts: 25
Registered: 12/6/12
Re: C++ Builder X3 Synchronize error
Helpful
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 5, 2018 2:50 AM   in response to: Tomasz Piotr in response to: Tomasz Piotr
Tomasz Piotr wrote:
Hi All,

I've been struggling with this all afternoon. My thread class is:

class TLoadingThread : public TThread
{
    protected:
        virtual void __fastcall Execute();
        void Spin(); //to be synchronized
 
    public:
        __fastcall TLoadingThread();
          void __fastcall GentleStop();
        long m_Stop;
};
My Execute method:
 
void __fastcall TLoadingThread::Execute()
{
    while (!m_Stop)
    {
        Sleep(1000);
        Synchronize(&Spin);
    }
 
    m_Stop = 0;
}

causes compiler error:

[bcc32 Error] WaitInfoWindow.cpp(59): E2285 Could not find a match for 'TThread::Synchronize(void (* (_closure )())())'
Full parser context
WaitInfoWindow.cpp(55): parsing: void _fastcall TLoadingThread::Execute()
also
Synchronize(Spin);

causes

[bcc32 Error] WaitInfoWindow.cpp(59): E2285 Could not find a match for 'TThread::Synchronize(void)'
Full parser context
WaitInfoWindow.cpp(55): parsing: void _fastcall TLoadingThread::Execute()

I read, for some only Synchronize(&Spin); works, for others both Synchronize(Spin); and Synchronize(&Spin); work too but with my none of these work. I'm using:

X3 C++ Builder Update1. Maybe it's something with compiler settings I should change?

best regards

Tomasz

Hi,
try to define your Spin function like this
void __fastcall Spin()
Tomasz Piotr

Posts: 4
Registered: 1/25/13
Re: C++ Builder X3 Synchronize error  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 5, 2018 2:59 AM   in response to: Andreas Wegener in response to: Andreas Wegener
It Works!!

Andreas, you saved my day, thank you!

regards
Tomasz
Andreas Wegener

Posts: 25
Registered: 12/6/12
Re: C++ Builder X3 Synchronize error  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 5, 2018 3:04 AM   in response to: Tomasz Piotr in response to: Tomasz Piotr
Tomasz Piotr wrote:
It Works!!

Andreas, you saved my day, thank you!

regards
Tomasz

Happy to be of any help :-)
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02