Search found 11 matches
- Wed Nov 22, 2006 9:36 am
- Forum: C++ Development
- Topic: Problem with wxThread::Wait - hangs console App
- Replies: 8
- Views: 3168
rve, I took on your suggestion and omited a call to wxThread::Wait before deleting the thread object. This solved my problem with debugger... Hm, looks like the manual needs an update. Can anybody comment if ommiting call to Wait before deleting thread object is the way to go about it, or can this ...
- Tue Nov 21, 2006 7:12 am
- Forum: C++ Development
- Topic: about synchronization
- Replies: 2
- Views: 955
- Tue Nov 21, 2006 7:08 am
- Forum: C++ Development
- Topic: wxSocket: how to find out peer is done
- Replies: 3
- Views: 971
Well... It is a console application using the socket stuff in a seperate thread. I tried to get the event stuff working but it was too much trouble so I didn't used it.boxcarmiba wrote:well i suggest a preferable way to handle peer disconnection is with the socket event method and the wxSOCKET_LOST flag.
- Tue Nov 21, 2006 7:02 am
- Forum: C++ Development
- Topic: Problem with wxThread::Wait - hangs console App
- Replies: 8
- Views: 3168
Re: Problem with wxThread::Wait - hangs console App
My thread is done, but the documentation says to call Wait before I delete it. Thanks Not sure if its related to your problem but the documentation is incorrect. You do not have to Wait() for a thread. I also had (different) problems with it. See: http://forums.wxwidgets.org/viewtopic.php?t=10873
- Mon Nov 20, 2006 11:43 am
- Forum: C++ Development
- Topic: wxSocket: how to find out peer is done
- Replies: 3
- Views: 971
Ok, I just posted this and came up with the following solution: while(!TestDestroy()) { if (m_socket->WaitForRead(1, 0)) { // Read() will return immediatly m_socket->Read(buffer, size); if (m_socket->LastCount()) { // no data, peer must be dead } else { // process data } } } It works as expected and...
- Mon Nov 20, 2006 11:19 am
- Forum: C++ Development
- Topic: wxSocket: how to find out peer is done
- Replies: 3
- Views: 971
wxSocket: how to find out peer is done
Hi, I have a thread with (basically) the following code. How do I find out how the peer has terminated the connection? (without using events). Also tried it with wxSOCKET_WAITALL, wxSOCKET_NOWAIT and wxSOCKET_NONE but never was able to determine if the peer has closed the connection.... I'm using wx...
- Mon Nov 20, 2006 9:11 am
- Forum: C++ Development
- Topic: wxThread.Wait() generate error messages
- Replies: 2
- Views: 1350
Had the same problem (see http://forums.wxwidgets.org/viewtopic.php?t=10873) and my conclusion was also the documentation was incorrect.
Could not find the bug report though...
Could not find the bug report though...
- Thu Nov 09, 2006 6:21 am
- Forum: C++ Development
- Topic: Proper way of terminating a joinable thread on MSW/GTK ?
- Replies: 5
- Views: 1928
I looked into the sources and found the following ways to end a thread: Delete(): signal the thread to terminate and wait until it does Wait(): wait until the thread terminates by itself Kill(): kill the thread It seems they all work as expected on joinable and detached threads. I think the document...
- Wed Nov 08, 2006 2:40 pm
- Forum: C++ Development
- Topic: Proper way of terminating a joinable thread on MSW/GTK ?
- Replies: 5
- Views: 1928
- Wed Nov 08, 2006 1:50 pm
- Forum: C++ Development
- Topic: Proper way of terminating a joinable thread on MSW/GTK ?
- Replies: 5
- Views: 1928
If you want a thread to stop, set a flag that the thread checks in every loop. Program the thread to exit if this flag is set. I think TestDestroy() is supposed to do that. From the wxThread docs: Calling Delete is a graceful way to terminate the thread. It asks the thread to terminate and, if the ...
- Wed Nov 08, 2006 9:56 am
- Forum: C++ Development
- Topic: Proper way of terminating a joinable thread on MSW/GTK ?
- Replies: 5
- Views: 1928
Proper way of terminating a joinable thread on MSW/GTK ?
Hi, I have an application with joinable threads. To terminate the thread I do ... thread->Delete(); thread->Wait(); ... (TestDestroy() is called frequently enough inside the thread) On MSW this gives the error 6: the handle is invalid. Looking at the source (MSW) it seems Wait() is doing the same th...