in reply to Re^7: Thread-safe modules and callbacks
in thread Thread-safe modules and callbacks

The messages need to be shared, I mean, probably the management of each message will last for too long, so the user can have the main thread continuosly checking the messages to look if something new arrived, it just does that when finishes the last one.
Apart from that I'm looking for a more generic solution when the user would need to do something with the arrived message before pushing in the array, and for that it'll probably need to use programs variables.
What i want to say is that the user doesn't know he is using threads so he defines the callback function and uses it like a normal function. Well, that approach is not possible, but something close to that is what I'm looking for.
Doing this in another language wouldn't be a problem with variables previous to Start() because they are shared by default.
  • Comment on Re^8: Thread-safe modules and callbacks

Replies are listed 'Best First'.
Re^9: Thread-safe modules and callbacks
by BrowserUk (Patriarch) on May 10, 2008 at 16:28 UTC
    Doing this in another language wouldn't be a problem with variables previous to Start() because they are shared by default.

    Sure. But the programmer would still need to know they were using threads, because they would need to perform locking and synchronisation before reading or writing any variable. IThreads avoids that need for most variables, because each thread has its own copy. So you only need to concern yourself with synchronising access to the those (usually very few) variables that need to be shared.

    Your lack of specifics about what needs to be shared and why, combined with your insistance that everything should be shared, but the user shouldn't need to know that he's using threads, suggests to me that you're just trying to make some negative point about iThreads, rather than actually write an application.

    If having a go at iThreads is your purpose, your doing a piss poor job. The safety and simplicity of only sharing that data that needs to be shared, is the one point that goes strongly in their favour.

    Good luck.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
      Well, I'm not critizising iThreads if that is what worries you (I didn't even knew that iThreads was the thread model of perl), It's a pity that my lack of knowledge on the english language doesn' allow me to express the way i wanted but i really think that you should be more sure about things before blaming anyone of whatever you think.
      Apart from that, my question here was trying to involve more that the actual solution to my problem. I was trying to see solutions for that kind of problems. Maybe my approach wasn't a good one.
        It's a pity that my lack of knowledge on the english language doesn' allow me to express the way i wanted but i really think that you should be more sure about things before blaming anyone of whatever you think.

        I did say "If".

        Once again I'll suggest that you post an example of how your library would be used in real-life situation. Natural language, especially when it is a second language, is notoriously difficult to construct clear and unambiguous descriptions in. Perl, as an unnatural language, can be far clearer.


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.