Home » U++ Library support » U++ MT-multithreading and servers » How to use Thread()
How to use Thread() [message #44016] |
Fri, 12 December 2014 22:21  |
 |
forlano
Messages: 1207 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
Hello,
So far I have never used Threads... and to tell the truth I am rather confused about them.
My GUI app frezee while some operation last 2 or 3 seconds (perform calculation and writing on a sqlite database). This is rather annoying because it seems the app is going to crash.
So I thought to run a Thread for this operation and let the GUI to be free to use for other task. I hope this make sense.
The problem is that the compiler is complaining about Upp::callback, see below, that I do not understand (I used the GUI MT flag).
The function I would like to run in a thread ( SavePairing(num1, num2) ) is a member function of an external class called 'vegadb' and 'DB' is just an instance of vegadb. I tried without success:
Thread().Run( DB.SavePairing(num1, num2) );
Thread().Run( callback2( DB.SavePairing, num1, num2 ) );
Thread().Run( callback2( vegadb::SavePairing, num1, num2 ) );
I tried even callback3. Does anybody have a suggestion?
Thanks,
Luigi
PS: typical error message:
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C3867: 'vegadb::SavePairing': function call missing argument list; use '&vegadb::S
avePairing' to create a pointer to member
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate4<P1,P2,P3,P4> Upp::callback2(const O *,bool (__thiscall M::* )(P
1,P2,P3,P4,Q1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(572) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate4<P1,P2,P3,P4> Upp::callback2(O *,bool (__thiscall M::* )(P1,P2,P
3,P4,Q1,Q2),T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(566) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate3<P1,P2,P3> Upp::callback2(const O *,bool (__thiscall M::* )(P1,P
2,P3,Q1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(523) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate3<P1,P2,P3> Upp::callback2(O *,bool (__thiscall M::* )(P1,P2,P3,Q
1,Q2),T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(517) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate2<P1,P2> Upp::callback2(const O *,bool (__thiscall M::* )(P1,P2,Q
1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(469) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate2<P1,P2> Upp::callback2(O *,bool (__thiscall M::* )(P1,P2,Q1,Q2),
T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(463) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate1<P1> Upp::callback2(const O *,bool (__thiscall M::* )(P1,Q1,Q2)
const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(415) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate1<P1> Upp::callback2(O *,bool (__thiscall M::* )(P1,Q1,Q2),T1,T2)
' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(409) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate Upp::callback2(const O *,bool (__thiscall M::* )(Q1,Q2) const,T1
,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(361) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Gate Upp::callback2(O *,bool (__thiscall M::* )(Q1,Q2),T1,T2)' : expe
cts 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(355) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback4<P1,P2,P3,P4> Upp::callback2(const O *,void (__thiscall M::*
)(P1,P2,P3,P4,Q1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(269) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback4<P1,P2,P3,P4> Upp::callback2(O *,void (__thiscall M::* )(P1,
P2,P3,P4,Q1,Q2),T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(263) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback3<P1,P2,P3> Upp::callback2(const O *,void (__thiscall M::* )(
P1,P2,P3,Q1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(221) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback3<P1,P2,P3> Upp::callback2(O *,void (__thiscall M::* )(P1,P2,
P3,Q1,Q2),T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(215) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback2<P1,P2> Upp::callback2(const O *,void (__thiscall M::* )(P1,
P2,Q1,Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(168) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback2<P1,P2> Upp::callback2(O *,void (__thiscall M::* )(P1,P2,Q1,
Q2),T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(162) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback1<P1> Upp::callback2(const O *,void (__thiscall M::* )(P1,Q1,
Q2) const,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(115) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback1<P1> Upp::callback2(O *,void (__thiscall M::* )(P1,Q1,Q2),T1
,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(109) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback Upp::callback2(const O *,void (__thiscall M::* )(Q1,Q2) cons
t,T1,T2)' : expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(62) : see declaration of 'Upp::callback2'
C:\MyApps\VegaTeam6\SemiManualPairing.cpp(1218) : error C2780: 'Upp::Callback Upp::callback2(O *,void (__thiscall M::* )(Q1,Q2),T1,T2)' :
expects 4 arguments - 3 provided
c:\upp\uppsrc\core\Callback2.h(56) : see declaration of 'Upp::callback2'
|
|
|
Goto Forum:
Current Time: Sat May 10 00:21:07 CEST 2025
Total time taken to generate the page: 0.01107 seconds
|