wxctb crashes : start_thread

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
killerbot
Experienced Solver
Experienced Solver
Posts: 75
Joined: Wed Dec 26, 2007 1:13 pm

wxctb crashes : start_thread

Post by killerbot » Fri Jan 30, 2009 10:26 am

I am using wxctb for serial communication in a wxWidgets based application.

However, often I get crashes the moment I want to start communication.

This is the stack trace I get (not much) :

Code: Select all

#0 (	0x0000007b in ??() (??:??)
#1 0xb76e6175	start_thread() (/lib/libpthread.so.0:??)
#2 0xb766adae	clone() (/lib/libc.so.6:??)
So during the creation of a thread (or starting it) things go wrong. wxctb creates threads for its timer functionality.

Anyone suffered from this, or has enough experience to help me out ?

many thanks.

spectrum
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 207
Joined: Sat Jul 21, 2007 12:17 pm

Post by spectrum » Fri Jan 30, 2009 5:19 pm

Hi killerbot,

i never used it for serial port, anyway is quite strange, i assume it should work, can you post some code on how you allocate and use wxctb object ?

thanks
spectrum

killerbot
Experienced Solver
Experienced Solver
Posts: 75
Joined: Wed Dec 26, 2007 1:13 pm

Post by killerbot » Sat Jan 31, 2009 12:37 pm

In a secondary thread,I send a request to a a device (through the serial port), and then I wait for the answer.

The program works ok on windows, but my linux build tend have to have those crashed mentioned above.Sometimes it works, other times crash;
On linux wxctb uses those temporary spawned/created threads for timer purposes [have the thread sleep the timeout amount of time and then set a variable].

These a a few of my code snippets :

1) at the constructor of my class :

Code: Select all

	m_SerialPort = new wxSerialPort();
	m_SerialPort->Open(ComPort.c_str());
	// temp check
	m_SerialPort->SetBaudRate(wxBAUD_115200);
2) In the Write method of my class :

Code: Select all

	unsigned int TimeOut = 5000;// in milliseconds
	int BytesRead = m_SerialPort->Readv(reinterpret_cast<char*>(Buffer), Size, TimeOut);
3) in my Read method of my class :

Code: Select all

	unsigned int TimeOut = 500;// in milliseconds
	int BytesWritten = m_SerialPort->Writev(reinterpret_cast<char*>(const_cast<MASAPP_UINT8*>(Buffer)),
		static_cast<size_t>(Length), TimeOut);
Hope this might help someone to help me ;-)

killerbot
Experienced Solver
Experienced Solver
Posts: 75
Joined: Wed Dec 26, 2007 1:13 pm

Post by killerbot » Tue Feb 03, 2009 9:53 pm

any wxctb users who might have an idea ??

Post Reply