作者 主題: SOS~~ c++0x 的 std::thread 編譯不過.  (閱讀 2838 次)

0 會員 與 1 訪客 正在閱讀本文。

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
SOS~~ c++0x 的 std::thread 編譯不過.
« 於: 2012-08-30 18:50 »

error: no matching function for call to ‘std::thread::thread(<unresolved overloaded function type>)’
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/thread:132: note: candidates are: std::thread::thread(_Callable&&, _Args&& ...) [with _Callable = void (session::*)(), _Args = ]
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/thread:128: note:                 std::thread::thread(_Callable) [with _Callable = void (session::*)()]
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/thread:124: note:                 std::thread::thread(std::thread&&)
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/thread:122: note:                 std::thread::thread(const std::thread&)
/usr/lib/gcc/x86_64-redhat-linux/4.4.6/../../../../include/c++/4.4.6/thread:121: note:                 std::thread::thread()
./src/wge.cpp:484: error: expected ‘;’ before ‘readClientRequest’



有沒有人遇過 一樣的問題 >_<"



你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: SOS~~ c++0x 的 std::thread 編譯不過.
« 回覆 #1 於: 2012-08-30 19:06 »
找到答案了...

因為我掛在~BOOST 的 IO_SERVER下,member function is overloaded .


http://stackoverflow.com/questions/9048119/why-doesnt-stdbind-and-boostbind-cant-be-used-interchangeably-in-this-boos

The boost::asio::io_service::run() member function is overloaded: one version takes no argument while another version takes one argument. That is, taking the address of the of boost::asio::io_service::run requires a context in which the compiler can directly deduce the signature of the function. However, std::bind() isn't required to do deduction magic while it seems that boost::bind() attempts to locate a matching overload i.e. it seems for its first argument type to be readily constrained (assuming the boost example indeed compiles).

你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......

FIEND

  • 鑽研的研究生
  • *****
  • 文章數: 700
    • 檢視個人資料
    • http://bbs.ecstart.com
Re: SOS~~ c++0x 的 std::thread 編譯不過.
« 回覆 #2 於: 2012-08-30 22:07 »
找到答案了...

因為我掛在~BOOST 的 IO_SERVER下,member function is overloaded .


http://stackoverflow.com/questions/9048119/why-doesnt-stdbind-and-boostbind-cant-be-used-interchangeably-in-this-boos

The boost::asio::io_service::run() member function is overloaded: one version takes no argument while another version takes one argument. That is, taking the address of the of boost::asio::io_service::run requires a context in which the compiler can directly deduce the signature of the function. However, std::bind() isn't required to do deduction magic while it seems that boost::bind() attempts to locate a matching overload i.e. it seems for its first argument type to be readily constrained (assuming the boost example indeed compiles).

剛想成功的CALL THREAD 了~


                std::thread bw(&session::brocastWrite,this);
                bw.join() ;

但是在~BOOST 下的 異步~IO 底下做會卡到另一個 PROCESS.

怪怪的~

所以乾脆~讓它繞過第二圈 遞迴式 CALL BACK 生成一個永遠有效的第三圈~做一個 開關 ,

後面跑支 FORK 控制 KERNEL 層的共享記憶體( KERNEL 層元件 的 SHM )來決定要不要讓流程走過去.......

應急用~>_<" XD ......

趕時間東西寫到都快四不像了~~我好爛~~~~

« 上次編輯: 2012-08-30 22:18 由 FIEND »
你累了嗎? 這樣不行 , 人要比 LINUX 兇 @@ " ......