another thread is created before program main starts!

Asked by Mohamad Alkowatly

Hi

I've had a weird case where a thread is automatically created when my program is started before hitting main!

using ps -eLf confirms that the process has two threads although the first two lines of the code is a printf and a getchar

using strace confirms a call to clone before any call from main

using gdb with a catch on clone system call and showing backtrace shows call to clone.S and two unknown (??) calls below

even more when the program exits glibc detects a double free memory error (!prev)

the program itself is a compiled C code, the code is generated by Simulink and uses some external libraries, but what distinguish it from other normal similar generated code is the use of:
1- opencv
2- ftd2xx
3- ueye camera driver

Does anyone have any clue why this could happen?

Cheers

Mohamad

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu eglibc Edit question
Assignee:
No assignee Edit question
Solved by:
Mohamad Alkowatly
Solved:
Last query:
Last reply:
Revision history for this message
Mohamad Alkowatly (idoit-ief) said :
#1

Hi

I've isolated the problem in loading ftd2xx library. An empty main of a probram linked with this library will have two threads. I guess that ftd2xx library is creating a thread when the library loads (I didn't know a shared library can execute something when loaded)

Regards,

Mohamad