This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Thread Creation


Respected Sir

I'm not able to understand
a few points in eCos 1.2.1 source code.
May I request you to put some light on the the 
following :-

 Supposedly I create a thread through API call

cyg_thread_create(. . . )

which requires address of an object of cyg_thread 
structure ( i.e. cyg_thread * thread) , along with 
other parameters. The data members of the class 
Cyg_Thread contain the data memebers of the 
structure cyg_thread. I don't understand, how 
exactly are they related.

Now the code inside cyg_thread_create (file name kapi.cxx)
is having the following statements :-

 Cyg_Thread * t = new ((void *) thread ) Cyg_Thread(
			(CYG_ADDRWORD) sched_info,
			(cyg_thread_entry *) entry,
			(CYG_ADDRWORD) entry_data,
			name,
			(CYG_ADDRWORD) stack_base,
			stack_size);
t=t;


Now, I have three doubts
 1. Which of the various overloaded new operators is 
	being used and what exactly does it do ?
 2. In new operator we are making a call to a constructor.
    How can we make a call to the constructor of a 
    class i.e. Cyg_Thread class. Traditionally, we
    can not make explicit call to a constructor.
 3. Also, what is the significance of the statement
    t=t; Isn't redundant ?
Sir, The above three doubts are very much generic, I would
   say. e.g. Similar is the case when a messagebox is created
   through the cyg_mbox_create API call.

Kindly Help !

********Sandeep Rikhi *******************



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]