Using of more than one thread

How can I use 2 or more threads at a time in a Java applet? Can anyone give me a very simple code that uses 2 threads in a java applet......thanks
And also, what if I want to use one of the thread for my text animation & the other for my word comparison? pls. do help me....

Kira_Ikari
Take a look at these, this is the kick-off page for a good tutorial:
http://java.sun.com/docs/books/tutorial/essential/concurrency/
These are targeted at j2me, but are well illustrated and are really good for getting a "feel" of how multithreaded programs operate under the hood:
http://developers.sun.com:80/mobility/midp/articles/threading/
developers.sun.com/mobility/midp/articles/tutorial2/
Regards, Darryl

Similar Messages

  • Posting topic to more than one thread and in different categories...

    Is there anything in the TOU we can "refer" to when users post the same topic in more than one thread and to add to that, more then one category? Case in point: http://discussions.apple.com/thread.jspa?messageID=8806009#8806009 (This is just one example)
    Limnos had a valid point. If we had a section in the TOU we could copy/paste from, I think it would help if we could refer to authority, ie., TOU.
    Thanks!
    Carolyn

    I wouldn't get into too much of a flury about that with end users. Notify as needed and let the moderators decide if it needs to be deleted. A good rule of thumb is you want the discussions to have:
    Everyone should feel comfortable reading Submissions and participating in discussions.
    That's from Terms of Use.
    And then there is:
    You agree to not interfere with or disrupt the Site.
    I'm seeing that logically one can conclude directing users not to crosspost may be considering interference with the site. I may suggest someone post in another forum if a solution is not transparent in the forum they are using, but that's as far as I'm comfortable bending the rules.
    I'm trying hard to keep my thumbs away from the keyboard when I see duplicate posts.

  • Can this be used on more than one computer?

    Can this be used on more than one computer?  (Multiple-users?)

    Hi Jessica,
    ExportPDF is for one user per account. Please refer to our terms... this should help with your questions!
    Let me know if this helps.
    Regards, Stacy

  • More than one Thread accessing the same records in the database

    Hi, I have more than one thread accessing a synchronized method called getMinPrimaryKey() which gets the lowest of the primary key frm the table based on the a flag which is set to true. once it is retrieved the same method also sets the flag as false so it is not retrieved the second time. so next time a different thread calls this method it should retrieve the next available lowest primarmy key.
    but even when i have the method as synchronized different threads keep returning the same primary key instead of getting the next sequence. can some one let me know where I might go wrong and what could be the solution. is it because when once i retrieve the record and set the flag as false, i also need to commit it?, which could be the reason the select query still picks up the same primary key. please help me out on this.
    thanks,
    Harish

    Correction. If different threads always return the same key then your table isn't getting up dated. If different threads sometimes return the same key, then either the database is committing lazily, or else the threads are calling getMinPrimaryKey on different objects and so are not executing atomically with respect to each other.

  • More than one thread in Openmp

    Hello Friends,
    I am trying to paralelize a great c program and now I am having problems for getting more than one thread.
    I tried it inside my code, at first I put omp_set_dynamic(0) and after I put omp_set_num_threads(4), but I got only one thread.
    These functions worked fine with a simple hello world code and I got to run 4 threads, but in my big code they didn't work. Could anybody help me? Any hint would be very good!...
    Regards,
    Glauber

    Hi,
    Thanks, It's a big code and was divided in 9 files, even so, I will post its most important parts.
    That functions are called from sequential part before the parallel region as you will can see below:
    // global.h
    #if defined (OMP_ENABLED)
    #     include "omp.h"
    #endif
    // main.c
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <math.h>
    #include <string.h>
    #include <stdarg.h>
    #include "global.h"
    #ifdef USE_READLINE
    # include <readline/readline.h>
    # include <readline/history.h>
    static char **readline_completion(const char *, int, int);
    #endif
    # if defined (OMP_ENABLED)
    int           proc_id; /* process ID (0, 1, ..., num_procs-1) */
    int           num_procs; /* number of active processors */
    # endif
    int main (int argc, char *argv[])
         int i;
    # if defined (OMP_ENABLED)
    omp_set_dynamic(0);
    omp_set_num_threads(4);
    num_procs = omp_get_num_threads();
    printf("Num procs: %i\n",num_procs);
    if( num_procs <= 1)
    exit(0);
    # endif
    //mcmc.c
    #include <stdio.h>
    #include <stdlib.h>
    #include <time.h>
    #include <math.h>
    #include <string.h>
    #include <ctype.h>
    #include <limits.h>
    #include <stdarg.h>
    #include "global.h"
    int RunChain (long int *seed)
         int          i, j, k, n, chn, stopChain;
         for (chn=0; chn<numLocalChains; chn++)
    #if defined (OMP_ENABLED)
    #pragma omp parallel for private(chn)
    #endif
              for (chn=0; chn<numLocalChains; chn++)
    If you need something else, please, return me
    Thanks in advanced
    Glauber

  • I am using iPhoto 11 mail and cannot add more than one recipient in the 'to' line.  When I put a comma in, the recipient's address is deleted.  If I use ' ' with more than one recipient the save grays out.  Any thoughts?

    am using iPhoto 11 mail and cannot add more than one recipient in the 'to' line.  When I put a comma in, the recipient's address is deleted.  If I use '< >' with more than one recipient the save grays out.  Any thoughts?

    I figured it out.  I needed to fix some errors in my account information.  It works fine now.

  • Can one computer be used by more than one itunes account holders

    Can one computer be used by more than one itunes account holders or can we no longer share a home computer to access our clouds?

    Hi Zhang Bin
    You can create one order from multiple  notification, but you cannot create multiple order from one notification.
    Exmaple- You can select all notification in IW28, and create one order. All these notification will appear in object list of order.
    Regards
    Anil Kumar

  • Can one Recordset created in the Main/Parent form be used in more than one Subform?

    Hi
    Can one Recordset created in the Parent form be used in more than one Subform?  The parent and subforms are unbound.
    If so, how do I do this?
    Many thanks for your help!
    smsemail

    You can declare a public object variable in the parent form's module's Declarations area:
        Public rs As DAO.Recordset
    Then, anywhere in the parent form's module:
        Dim strSQL As String
        strSQL= "SELECT etc"
        Set rs = CurrentDb.OpenRecordset(strSQL)
    In a subform's module, or anywhere else for that matter while the form is open, you can return a reference to the recordset as a property of the class:
        Form_YourParentFormName.rs
    Ken Sheridan, Stafford, England

  • Can a single datasource be used by more than one Application running on the

    Can a single datasource be used by more than one Application running on the system?

    What, in this context, do you mean by "datasource"?

  • Can one Communication Channel be used in more than one sender agreement?

    Can one Communication Channel be used in more than one sender agreement?

    It depends on your scenario...let me tell you a case where you can use one communication channel in more than one sender agreement...
    If you have an RFC sender channel this can be used in any number of sender agreements....
    Thanks,
    Renjith

  • TS4124 can imatch be used for more than one persons library of music, or does each person require a separate imatch account?

    Can iMatch be used for more than one person's library of music, or does each person require a separate iMatch account for their own library?

    1 account = 1 library, 2 = 2 and so on.

  • Can apple tv be set up on a network to be used on more than one tv at a time?

    I am trying to find out if I can use my Apple TV on more than one TV at a time over a home wireless network?

    It only has a single HDMI out.
    Unless you can find some third party solution or AV amp that will duplicate the output over additional HDMI outputs the answer is no.
    You could take an AppleTV from room to room where it is needed and connect to the TV in use, but if you want more than one AppleTV feed best to get another AppleTV...
    AC

  • Adobe Form used by more than one user simultaneously

    Friends,
    I am working on an online interactive Adobe form using Web Dynpro ABAP.
    once the user enters the data and clicks the submit button, the data is sent to ztables.
    the scenario is that more than one user can possibly use the same form simultaneously. in that case, how can i maintain synchronization ie how to avoid multiple users from using the form at the same time, when the form is already being filled by one user already.
    I am guessing i have to do something with ADS for this.
    Any thoughts or ideas would be greatly appreciated.
    Thanks and Regards.

    Hi Bertrand,
    The purpose of allowing only one user is to ensure data consistency as you have guessed.
    Is there a program name or transaction code where i can look up the lock entries and see if i can apply them to my web dynpro application or the adobe form.
    I would greatly appreciate your help.
    Thanks and Regards.

  • Can't SSAS engines make use of more than one aggregation to answer a query?!

    I have a very simple cube (just for testing and training) . This cube contains two dimensions: [Dim Soccer Player] contains one attribute hierarchy [player name], the other dimension
    is [Dim Match Acts] contains also one attribute [Acts] which has values like fouls, goals, saves, tackles… etc. And of course a Fact that contains one measure of Just Count ... that simple ... so this cube can
    answers a question like how many goals scored by "Messi", for example ... a very simple trivial cube.
    I'm testing aggregations and their effect. so first I've designed one aggregation (Aggregation 0) on the granularity level of [Player name], then
    I run a query to get the count of ALL the[Acts] done by each [Player name] ... I've checked the SQL Profiler and I found that the aggregation was used.
    Then I cleared the cache, and I run another query, but this time to get just the number of Fouls committed by each [Player name], I checked the Profiler but the Aggregation 0 was NOT used.
    I went back to the aggregations design tab in BIDS, and I added another new aggregation (Aggregation 1) on the level of [Acts], so now I have two aggregation one on the granularity level of
    [Player name] and the second on the level of the [Acts].... I cleared the cache again and rerun the last query. NONE of the aggregation was used!
    In the third test I deleted Aggregation 1 and added [Acts] to Aggregation 0. so Aggregation 0 now on both [Player name] AND [Acts]... cleared the cache and rerun the last query. Aggregation
    0 appeared again.
    I just want to make sure (and if possible know why) the SSAS engine can't make use of and combine more than one aggregation to serve a query (point number 2), and that to design an aggregation
    that will serve a query which contains attributes from different dimensions, I have to add ALL the attributes in that query in that one aggregation, like point 3 ... is this true?!

    I think you are on the right track. You need to include all the attributes used in one query in the same aggregation (like #3) for it to be used. Example #2 works as I would expect. Queries above the grain of the agg (query by player name and an agg by
    player/act can be used) can be used. Queries below grain of the agg (example #2) can't use the agg.
    http://artisconsulting.com/Blogs/GregGalloway

  • Can it be used on more than one computer?

    I have purchased my iPod online, and I am travelling to the US soon, which is where I will pick it up. I am going there on holiday, and it would be perfect if I could use it during the holiday rather than just carrying it round.
    If I was to register it on my uncle's computer (he has iTunes), and maybe sync the iPod with some of his music, would I then be able to use the iPod with my computer back in the UK. Does it affect the registration of the iPod - will I have any problems doing this? Any help appreciated.

    Yes, it's true! He'll have to change his iPod configuration to Manual Sync. But if he connects his iPod to other computer than his when it's configured automatically, his music won't have necessarily to be wiped out, unless he doesn't click "Cancel" after appearing a little pop-up message.
    Although, thanks for adding this important point to my post!
    Much Appreciated.

Maybe you are looking for

  • How to I get the shows downloaded on Apple TV to sync to iTunes on my mac?

    I have downloaded TV shows using Apple TV. How do I get those shows to sync with my iTunes on my mac so I can watch them on my computer?

  • Emails sent from iPad

    Emails that I send from my iPad4 to my laptop or PC using either of my alternate email addresses just disappear. Whilst they arrive on the computer, they just as quickly disappear into the ether never to be seen again. I have searched every folder bu

  • Connecting to Secure Wireless

    Hello Everyone! I have had my MacBook for about 8 months now, and it seems that whenever I try to connect to a wireless network that requires me to sign in on a web page (ie a bookstore or downtown wireless network) it rarely lets me open the web pag

  • ERROR: Unable to find AL_JobService.pid file in $LINK DIR/bin directory

    Hi,     We have a recent issue and could not find an appropiate reason, we have been running jobs in the linux server for almost 5 months now and we never had an issue.                  Today the jobs wouldnt start - a blank trace log so we decided t

  • HT2534 I don't have the none option why?

    I can't seem to make an apple account because I don't have the none option on payment