note: i am forwarding this response to the main ML as its relevant information for everyone.
the interfaces on mk_plugin.c are mostly used by plugins (monkey/plugins/*). As Monkey core is able to handle socket events on an epoll() loop, the plugins requires from a mechanism to register their own sockets (or just hook to certain events from an existent socket) and use the same loop. In order to accomplish that, each thread also have a list of events being used by plugins, that list is headed by mk_plugin_event_k which is a pthread key, so each thread have a global-thread-scope variable to reference the list of events being used by plugins. regards, ---------- Forwarded message ---------- From: Savita Seetaraman <[email protected]> Date: Fri, Mar 14, 2014 at 5:01 AM Subject: Re: [Monkey] Interested in participating GSoC 2014 To: Eduardo Silva <[email protected]> Hello, I was checking where pthread_getspecific () gets used. This is what I understood about pthread_getspecific () - I see that it returns the value of the pthread_key passed to it and this value is specific to each thread. However, this value is shared by various functions in the thread. In the source code, one of the numerous instances where pthread_getspecific () gets used is in the function - *mk_plugin_event_get (socket)* which further calls *mk_plugin_event_get_list (socket)*, which calls *pthread_getspecific (mk_plugin_event_k)*. I would be grateful if anyone could explain why pthread_getspecific () is used here ? I understand that it is supposed to return the specific value for a thread. It is clear that if the thread still exists, it would still have a specific value. So is pthread_getspecific used only to determine if a thread still has a context or not ? Or is there another reason ? Thanks and regards, Savita
_______________________________________________ Monkey mailing list [email protected] http://lists.monkey-project.com/listinfo/monkey
