I'm not sure what you are saying. First of all, that is not a spin loop
looking for information. It blocks until a message comes in or a timer
goes off. It will tend to use very little CPU unless you open a *lot*
of domains.
Second, you really don't need two threads here. The function of
second_thread() is non-blocking and will return immediately. You can
simply call (not spawn a thread) second_thread(), then spawn
first_thread(). If the "main" thread here after returning from
Ipmi_Task::open(), you can just call the operation loop there and not
spawn a thread at all.
Third, is handle_domain() printing anything? Also, as I have said
before, that function will be called when the connection is set up, not
when it has finished setting up/scanning the domain. It is useless to
iterate the entities at that point in the program, because there won't
be any until it has set up the domain. So you program here will
basically print "Domain open error" and then not do anything else.
You need a return after ipmi_domain_iterate_entities or it will always
print the error. And you should probably print the error value.
You need iterate the domains in a different place. Look at the later
parameters in ipmi_domain_open. There is one that is called when the
domain is fully up. Use that one to iterate the entities.
-corey
[EMAIL PROTECTED] wrote:
> Hii,
> operation_loop ( os_hnd->operation_loop(os_hnd) ) is not running in my
> program. In my program in the open() function,
> i am allocating & initialize the os_handler ,then i spawned two threads,
> first thread dedicated for running the
> operation_loop ( os_hnd->operation_loop(os_hnd) ),second thread for
> dedicated to making connection, opening the domian
> to the IPMI server and getting the sensor details . my program as
> follows..
>
> -------------------------------------------------
>
> static os_handler_t *os_hnd; //global variable
> int Ipmi_Task::open()
> {
> os_hnd = ipmi_posix_setup_os_handler();
> if(!os_hnd)
> {
> printf(\"Error:Unable to allocate to OS handler\\n\");
> return 0;
> }
>
>
> //OpenIPMI init
> ipmi_init(os_hnd);
>
>
> // spawning first thread
> spawn_n(1, ACE_THR_FUNC (first_thread),
> ACE_reinterpret_cast (void *, NULL),
> THR_NEW_LWP | THR_JOINABLE);
> // spawning second thread
> spawn_n(1, ACE_THR_FUNC (second_thread),
> ACE_reinterpret_cast (void *, NULL),
> THR_NEW_LWP | THR_JOINABLE);
>
> }
>
> void *first_thread()
> {
> os_hnd->operation_loop(os_hnd);
> }
>
> void handle_sensor(ipmi_entity_t *entity, ipmi_sensor_t *sensor, void
> *cb_data)
> {
> // taking sensor getails
> }
> void handle_entity(ipmi_entity_t *entity, void *cb_data)
> {
> ipmi_entity_iterate_sensors(entity, handle_sensor, tmp_obj);
>
>
> }
> void handle_domain(ipmi_domain_t *domain,
> int err,
> unsigned int conn_num,
> unsigned int port_num,
> int still_connected,
> void *user_data)
> {
> if(err)
> {
> goto out;
> }
>
> ipmi_domain_iterate_entities(domain, handle_entity, tmp_obj);
>
> out:
> printf(\"Domain open error\\n\");
> }
>
>
> void *second_thread()
> {
>
>
> rv = ipmi_ip_setup_con(tip, tport, 1, authcode, priv_code, (void*)
> this->m_user, user_length,(void *) this->m_pass, pass_length, os_hnd, NULL,
> &con);
> if (rv)
> {
> printf(\\\"Error:Unable to setting up LAN connection\\\\n\\\");
> }
>
>
>
>
> rv = ipmi_open_domain(\"\", &con, 1, handle_domain, this, NULL, NULL, NULL,
> 0, NULL);
> if (rv)
> {
> printf(\\\"Error:Unable to open domain\\\\n\\\");
> }
>
>
> }
>
> ------------------------------------------------------------
>
> my problem is \'operation_loop\' not running , please give the solution for
> this problem .
>
>
>
> Thanks,
> Barani
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by DB2 Express
> Download DB2 Express C - the FREE version of DB2 express and take
> control of your XML. No limits. Just data. Click to get it now.
> http://sourceforge.net/powerbar/db2/
> _______________________________________________
> Openipmi-developer mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openipmi-developer
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Openipmi-developer mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openipmi-developer