Rocky Craig wrote: > Corey Minyard wrote: > > >> OpenIPMI works in mutli-threaded environments. >> >> > I concur, having written threaded apps that work with the driver. > That being said, the driver intrinsically knows nothing about pthreads. > > Treat it as a read/write resource and adhere to normal concerns about > concurrency and synchronization. If you have multiple threads > mucking about that file descriptor, YOU need to provide the locking/ > exclusion/whatever. > > Rocky > I was actually talking about the library, but I see now that the question wasn't specific to that.
For the driver, it works as Rocky says. If you open a single file descriptor, multiple threads can safely read/write it. You don't need locks for that, but you do need locks to manage your own data of course. However, you will need some mechanism to tell where responses should go, as the driver will deliver the response to the first reader, not necessarily the thread that sent the query. Or, each thread can open its own file descriptor and the driver will manage getting the responses back to the proper one. In my response, I was talking about the library. It is also designed to be multi-threaded and has proper locking to manage that, if you use the proper OS handler. That said, unless you have some pressing reason to be multi-threaded, like scalability needs and SMP or having to handle operations with various priorities, I'd recommend not writing a multi-threaded program. Or perhaps you are interfacing to a library that is not designed to be event-driven. Threads add complexity which reduces reliability. OpenIPMI can be used event-driven mode, which means that you can have a quite live system without having to have multiple threads. The documentation describes this in detail. -corey ------------------------------------------------------------------------- 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
