OS 6.0 + sqLite Multithreading and synchronized

I am trying to create an application that has multiple threads running in the background. In total, there are 5 wires including the UI thread and everything would be publishing and reading of data.

I created a static final object to be used for the synchronization.

For each SQL statement, I join in

synchronized (GlobalVariables.lockObject) {}
Create or open the database
CREATE statement
Prepare surveys & run
Close the database
lockObject.notify)

}

In principle I think it should work in multithreaded environment. However, it doesn't. It works for the user interface thread but then it waits indefinitely to prepare the declaration for the background thread to random places in my code and is not go forward until I take action in the UI thread that makes a database operation.

This works perfectly in OS 7.0, but does not not in 6.0 Simulator and devices.

Can someone help me out here? I'm really stuck here the last 4 days.

Thank you

I found the solution.

Apprantly in my case, I had a UI element invalidating his element parent in the paint method.

So IU went into an infinite loop and since in OS 6.0 UI methods takes a higher priority and the thread is kept on until that user interface methods are completed he was trapped in the thread.

Thank you to everyone who reads this post and tried to help me.

Tags: BlackBerry Developers

Similar Questions

  • Updating Firefox, my old profile said places.sqlite.corrupt and I can't get bookmarks

    Firefox crashed while and refreshed himself. He created a "old firefox data" folder on my desktop. I thought I followed the instructions correctly, I deleted the profile information in my new program firefox (appdata). and I copied pasted old data from firefox (desktop folder) into its place.
    When I restarted firefox, it has reopened all of my tabs that were open in the crash initially. So I thought everything was great. Then I noticed that my favorites are missing, and the tool bar was empty. My history file is also empty. When I looked at my profile, I found that I places.sqlite.corrupt file.
    I found a site that talks about downloading a program to fix places.sqlite, but I'm not a programmer and I don't understand how to do it. I don't want to make things worse, so I'm leaving it alone.

    It is possible that the places.sqlite has been corrupted by the accident and may not be used.
    You would have to restore a backup of the folder bookmarkbackups on the desktop.
    In this way, you can restore the bookmarks, but will lose the history (there is no backup history).

    You can check for problems with the database places.sqlite file in the Firefox profile folder.

  • Multithreading and partitioned shared memory

    Hi all

    I'm having no success with this problem multithreading (simple?) on my processor core-i7, using CVI 9.0 (32-bit compiler).

    In the snippets below, I have a structure of node 5 integers, and I use 32 calls to calloc() to allocate space of 32 blocks of 128 * 128 nodes (16K) and store pointers returned in a table as a global var.

    Size in bytes of the nodes = 20, size in bytes of the block = (roughly) 328KB, total allocated size in bytes = (roughly) 10.5 MB.

    I have then spawn 32 threads, each of them is passed a unique index in the pointer_array of 'node_space' (see code below), kind, each thread handles (read/write) a block separated from K 16 knots.

    It must be thread-safe and multiply by the number of threads because each thread is addressing a different memory block (with no overlap), but not multithreading go more quickly (maybe a little) to a single thread.

    I tried different sizes of thread pool, filling of the nodes to the limits of 16 to 64 bytes, all to nothing does not.

    Is this a problem of band bandwidth memory due to the size of the tables? Each thread is somehow loaded the whole 32 blocks?  Any help appreciated.

    struct node

    {
    unsigned int a;
    unsigned int b;
    unsigned int c;
    unsigned int d;
    unsigned int e;

    } ;
    typedef struct lymph nodes;
    typedef nodes * Node_Ptr;

    Node_Ptr node_space [32];          / * pointer to table in 32 separate blocks (loaded via individual calloc calls for each block) * /.

    .... Spawning wire...

    for (index = 0; index)< 32;="">

    CmtScheduleThreadPoolFunction (my_thread_pool_handle, My_Thread_Function, & index, NULL);

    Hello CVI_Rules,

    It is difficult to answer your question because it depends on what you do in your thread function. Given that you do not see any speed upward in your program when you change the number of threads in your thread pool, you are done as well (or all the work) in each thread, serialize your threads with locks, or somehow slow down execution of each thread.

    Your basic configuration seems fine. You can simplify it slightly by moving the nodes directly to your thread function:

        for (index = 0; index < 32; ++index)
        {
            CmtScheduleThreadPoolFunction(pool, My_Thread_Function, node_space[index], NULL);
        }
    
    ...
    
    static int My_Thread_Function(void *functionData){    Node_Ptr nodes = functionData;...
    

    But this will not affect performance.

    Things to look at:

    1. Check that you're really work only on a subset of node space in each thread, you are passing and receiving the correct node space in each thread and you work only on that one.
    2. Verify that you do not have locks or other synchronization in your program. It seems that you do not have because you have designed your program so that it would not need any. But check anyway.
    3. Check that you do not have something useless in your thread function. Sometimes people call ProcessSystemEvents or ProcessDrawEvents because they feel that it makes the user interface more responsive. These two functions are expensive (all about 20 ms per call, I think). So, if you call these functions in a loop, with a fixed number of iteraction on all threads, and if the actual calculations are relatively fast, then these functions can easily dominate the runtime of your program. (There aren't necessarily those functions, it may be others. "These are just examples).
    4. Show and explain your code to a colleague. Sometimes, you don't see clearly until you show someone. Or they may have noticed something.

    Apart from this, can you explain what you are doing in your thread function so that we can have a better understanding of your program and what might inhibit parallelism?

  • Multithreading and interactions with instruments

    I have to start by saying that I'm not a great programmer. I build an instrument that requires a computer interface, and I learned how to program at the time of writing the program, for most documentation work (which means I have re-written program one half package of time I learned new things like how to define data structures and so on).

    My question is about multithreading - in my application, I use the GUI to write a series of instructions, and then I press a "Start button" which loads the instructions on a Board that interprets and outputs some call digital logic by the precisely. In addition, if specified, the button 'start' begins a task DAQmx that takes a trigger of my Board and acquires data. As these scans can take a long time, it is better for me to run in a separate thread. I also try to run an additional thread that queries the Board of Directors for its status - if it is running, waiting for a trigger or stop - and updates a control LED to reflect the State periodically. The problem I have is that programming function, the Board of Directors and the audit of the State function has some overlap, which I imagine is the reason why I'm the General Protection faults.  I read on the Thread hangs and Thread-Safe queues, but those who seem to be especially on the transmission of data between threads. Ideally I would be able to make sure that two threads do not call the same function at the same time - how would implement this?

    In addition, I don't know if it is a problem of the two threads calling the same function at the same time (I dunno if it of a problem or not), or if the problem is the fact that when I call these functions, they need to access the USB interface and there may be some sort of conflict between them.  I'm really hitting a wall here because I think that I don't have a solid understanding of the operation of allocation memory and battery function.

    Hi Paul, from your description, it seems very likely that you have problems with contemporary access to the same resource from multiple threads, which could explain the GPF you receive.

    Thread locks are a common way to handle such situations, because they can allow a single thread to protect it from another thread any access to the shared resource.

    Locks are used is:

    1 create a lock before you need to use it (possibly at the start of the program)

    2. when a thread needs to access the USB port to communicate with the instrument, it must call CmtGetLock to block access from other threads: If the lock is free, it is acquired by the threads. If it is already owned by another thread, the thread waits on the CmtGetLock until the bolt is free

    3. once a lock is finished using the shared resource, it must call CmtReleaseLock to permitt the access to the resource from other threads

    4. at the end of the program, destroy the lock

    If you do not want to stay frozen in CmtGetLock of a thread there is a function in the library if the lock is free or not, so that you can stay in a loop waiting for the lock to be free, but with the wire still alive and able to continue its work (still without access to the shared resource (, of course).

    It is crucial that acquired locks are always released, otherwise the other threads will be permanently excluded from access to the shared resource: this review is particularly important when adding threads management, because you must be sure to release locks acquired even errors, when a policy of the commune is to jump to a label inside the error handling function and it is possible that a lock is held acquired errors.

  • Not appear on the page summary of Itunes with my phone connected and synchronized to the top of the applications.

    Someone knows a problem on windows 10 with synchronization of items from their phone to Itunes? More specifically, when I plug in my Iphone and sync it to the top, my apps not will appear on the left side of the summary page. They are on my phone and appear on the right in the pages. but not on the left side individually.

    Connect to iTunes

    Click the drop-down next to your name at the top right menu

    Click on "buy".

    When the iTunes store opens, select applications, not in my library, iPhone

    In the lower right corner of iTunes, you should see a download button

    Download all and they will appear on your summary page

  • Replace the audio with and synchronizing with separate record

    Hello

    I read everything I can find, including many websites, the help file and a book, but can not find this response with instructions step by step using first Elements 9.

    I have the trial version and will purchase once I have understand that. I just need to make Youtube videos with a separately recorded audio file replaces the audio that is already on the video. in other words, I have a separate audio file to Mp3 of the same audio performance with an audio recorder and I want to replace the original video with the other Mp3 audio.

    What are the steps to ensure that the new audio is in sync with the audio already on video, from the original recordings and working through to the finished product?

    Thank you.

    I'm not Steve, but will offer my thoughts:

    • Most of the PrE users use Audio from their cameras, and less use separate devices, although I see more and more that.
    • Most of the PrE users do not 'clips', but again once, I see more and more of this in this forum.
    • It is probably impossible that an author can cover all the possible uses of a program, as before, even if they made a version three volumes. There are simply too many possibilities. Maybe Steve should consider making a companion book to his great tips & tricks, along the lines of "really advanced uses for PrE?
    • If any covered Steve implement, we wouldn't have much to do in the forum...

    I'm glad you don't have Steve's PrE book. If you decide to go with the pre as your NLE program, in light of what you do, I would add also, her book tips & tricks that you will most likely receive the gems inside.

    Good luck and happy editing.

    Hunt

  • The synchronized application: creation of menu items for each call to makeMenu SQLite?

    A matter of design, which is a good implementation of the following?

    My requirements are:

    1. Have a different menu for each screen.
    2. The battery of the screen will be high both a single screen.
    3. To switch screens, the user must use the menu.

    I created the menu for each screen by the following:

    protected void makeMenu(Menu menu, int instance) {
    super.makeMenu(menu, instance);
    Database db = null;
    try {
    
      db = ResourceManager.getConnection(true);
      mCoffeeDao = new FlavshellDao();
      mTabDao = new FlavmDao();
    
      if (instance == Menu.INSTANCE_CONTEXT) {
          Bitmap logoWbg = Bitmap.getBitmapResource(resource
                  .getString(ScoreCenterResource.logo));
          Image image = ImageFactory.createImage(logoWbg);
    
          gMenu.setIcon(image);
          nMenu.setIcon(image);
          aMenu.setIcon(image);
          shMenu.setIcon(image);
          avMenu.setIcon(image);
          logoMenu.setIcon(image);
    
          menu.add(gMenu);
          menu.add(nMenu);
          menu.add(aMenu);
          menu.add(shMenu);
          menu.add(avMenu);
          menu.add(logoMenu);
      }
    
      if (instance == Menu.INSTANCE_DEFAULT) {
          menu.add(logMenu);
          menu.add(exitMenu);
    
          shell = mCoffeeDao.findAll();
    
          for (int i = 0; i < shell.length; i++) {
              Flavshell m = shell[i];
              /**
               * Ordering parameter, lower values are placed closer to the
               * top of the menu screen.
               */
              item = new FlavMenuItem(m.getPk(), m.getFlavortitle(),
                      200 + i);
              menu.add(item);
          }
    
          String[] params = {
              Integer.toString(this.mCoffeePk)
          };
          Flavm[] m = mTabDao.findByDynamicWhere("FLAVOR = ?",
                  params);
    
          if (m.length > 0) {
              for (int j = 0; j < m.length; j++) {
                  if (m[j] != null) {
                      Flavm specificMenu = m[j];
                      item = new FlavMenuItem(specificMenu.getPk(),
                              specificMenu.getTitle(), 100 + j);
                      menu.add(item);
                  }
              }
    
              menu.add(MenuItem.separator(105));
          }
      }
    
    } catch (FlavshellDaoException e) {
      Logger.logEventError(e.getMessage());
    
    } catch (FlavmDaoException e) {
      Logger.logEventError(e.getMessage());
    
    } finally {
      try {
          db.close();
      } catch (DatabaseException e) {
          Logger.logEventError("Menu Database error: " + e);
      }
    }
    

    I created a database with a single link object read in the following text:

    public synchronized static final Database getConnection(
        final boolean readOnly) {
    Database db = null;
    try {
        URI userFileURL = URI.create(System
                .getProperty("fileconn.dir.memorycard")
                + resource.getString(CoffeeHouseResource.db_path)
                + resource.getString(CoffeeHouseResource.db_name));
    
        db = DatabaseFactory.open(userFileURL, readOnly);
    
    } catch (MalformedURIException e) {
        Logger.logError("Get connection: URI: " + e.getMessage());
    } catch (ControlledAccessException e) {
        Logger.logError("Get connection: Controlled Access: "
                + e.getMessage());
    } catch (DatabasePathException e) {
        Logger.logError("Get connection: Database Path: "
                + e.getMessage());
    } catch (DatabaseIOException e) {
        Logger.logError("Get connection: Database IO: "
                + e.getMessage());
    } catch (Exception e) {
        Logger.logError(e.getMessage());
    }
    return db;
    }
    

    My question is,

    • If the user to call the menu as happening in any other activity database (SQLite), making the synchronized method will prevent database locks?
    • Should I design my makeMenu got a call from the database at all? It seems to me that all this works, this could potentially cause a lot of traffic on the SQLite database?
    • I thought to move the menu to a vector and storing the menu in storage Runtime, but I read that the Runtime Storage has the memory leak issues?

    Your basic design principles seem well - I have a number of applications that actually have "tabs" screens, so clicking on a tab or using the menu swaps from one screen to the other.  You can just push the new screen and pop, that. In fact, here's a menu from a screen, that I am currently working:

    _StatsMenu MenuItem = new MenuItem ("Stats", 110, 10) {}
    public void run() {}
    UiApplication.getUiApplication () .pushScreen (new StatsScreen (System.currentTimeMillis (), 0));
    UiApplication.getUiApplication () .popScreen (BaseScreenWithToolBar.this);
    }
    };

    While I haven't looked in detail, but your code dangerous look.

    I've never tested, but I suspect makeMenu is called using the EventThread.  Doing things like database connections in this method will cause you problems.  Do not.  If you need to query the database, do so before makeMenu is called.  Starts a separate Thread and set the appropriate menus if this Thread is not finished.  or block the user interface, until he made.

    In addition, I wouldn't do it in makeMenu:

    Bitmap logoWbg = Bitmap.getBitmapResource (resource
    .getString (ScoreCenterResource.logo));
    Image image = ImageFactory.createImage (logoWbg);

    You can do it once to the creation of the screen, or better yet, once at startup and save it in a shared domain.

    If you do not want to create a dynamic menu, then use the normal persistent store - or check out the details for the database once at startup and use them after that RAM.

    And avoid lifting heavy objects in makeMenu.

    I hope this helps.

  • I have Photoshop installed on my desktop and laptop. The photo folders are synchronized between them, but I don't mean to maintain synchronized so catelogs. What folders/files I need to copy to keep items Organizer catelogs and keywords, the t

    I have Photoshop elements 14 installed on my desktop and laptop. The photo folders are synchronized between them, but I don't mean to keep synchronized and catalogs. What folders/files I need to copy to keep organizing items catalogs and keywords, tags, synchronized on the laptop and the face recognition Office?

    oliverk3402531 wrote:

    I have Photoshop elements 14 installed on my desktop and laptop. The photo folders are synchronized between them, but I don't mean to keep synchronized and catalogs. What folders/files I need to copy to keep organizing items catalogs and keywords, tags, synchronized on the laptop and the face recognition Office?

    Looking for the location of your catalog in the menu help > system information. It's all the folder containing the database file catalog.pse14db.

    It's easy to synchronize your catalog...

    But...

    Even if the media folder tree has the same structure, which does not work and all your files will be displayed as "offline" in the catalog synchronized. The reason is that the catalogue in computer stores the location of the media files by the full path AND the identification of the drive (internal serial number). The synchronized catalog will not find files on computer B.

    So, what would be your choice?

    -Store your multimedia files on an external drive and plug it alternately on both computers. No need to synchronize media files; You can even save the catalog on the external drive, no need to synchronize the catalog folder either. Downside: who does not act as a backup. You can use your sync as a simple backup to restore in the drive of origin if necessary.

    -According to John R Ellis, you can assign the same serial number for both drives.

    psedbtool (database of the elements of Photoshop tool)

    I have not tested this, but it should work.

    -The good old method of backup and restore, forgetting the 'sync' is slow, but much more secure (you have two copies over a backup). The HUGE advantage is that you can easily migrate to another computer and still another version of elements, even another OS.

    -My own solution requires some fiddling with the sqlite database and a good understanding of the structure of the database. I have syncs media and catalog or via Synctoy Windows files on an external drive. I create a copy of the catalog I have change in sqlite to point to the serial number of the external drive. The catalogue of the external drive and media are available to any computer with the same version of elements. The advantage of the 'synctoy' method is that it is much easier and faster than an incremental backup in the Organizer.

  • OS, re-installed, lost firfox and parameters. tried to copy on the places.sqlite form a restored version of a backup of the ms system but that firefox deletes copied to

    OS, re-installed, firefox lost and setting. I have no backup of bookmarks. Tried to copy places.sqlite to restore system from 19/12/2014 80 k size while firefox is down. After that firefox is brought backup, 80 k places.sqlite disappeared, replaced by the version of size 10 k.

    Note that the file places.sqlite fixed file sizes and is increased in segments of 10 MB.

    Also be sure to remove all temporary files from SQLite places.sqlite - shm and places.sqlite - wal when present.

  • localStorage and webappsstore.sqlite

    My understanding is localstorage is kept in the webappsstore.sqlite file and which is persistent even after the closure of firefox.

    Not the case with me. I use "FireStorage more!" of FireBug (FSP)! and also Javascript to create random values in localstorage on site example.com .

    I can see the entries of FSP!, however, if I open the webappsstore.sqlite it is always empty and the size never changes.

    If I restart Firefox the localstorage for example.com is empty and it says FSP as well now!

    This isn't sessionStorage but localStorage.

    What I am doing wrong or have I misunderstood the localStorage?

    My second question is how can I increase the maximum size of localStorage?

    You can create an exception to allow the cookies and localStorage data you want to keep.

    You can control and manage permissions for the domain in the tab currently selected through these steps:

    • Click the address bar onthe Site identity button"(globe/lock)
    • Click on 'More information' to open ' tools > Page Info "with the Security tab is selected
    • Go to the permissions tab (Tools > Page Info > permissions) to check the permissions for the domain in the currently selected tab

    You can control and manage permissions for all areas on the Subject: authorizations page.

  • BlackBerry Bold 9700 and SQLite, DatabaseIOException

    I developed an Application for the Blackberry Storm with Api 5. He make some insertions in a SQLite database and read them to show in a picturescrollField. No problem at all.

    The code is as simple as this:

    HI fastidias,

    I think you try to create or open a .db (sqlite) to the memory of the device file.

    There is a problem with 5.0 OS Bold (9700) it will not access the device memory .db file.

    If you attempt to run the same on Strom (Simulator even) it will work.

    Resolution: Make sure to create/access your .db on SD card file only. espicially for "BOLD" devices.

    Please let us know the results by changing the path to SD card and also on Strom.

  • Address bar doesn't work does not and is not AutoComplete. Places.SQLite file is not damaged.

    Since the last update, Firefox 49 and 50, the address bar has stopped working. First of all, it would not be before semi-automatic with my browsing history, and now he's not let me even in Web sites. I checked the places.sqlite file and it is not corrupt. I also tried to disable hardware acceleration, but it does nothing more. However, I started Firefox in safe mode and it works very well. What should be the problem here?

    Hi, because it works in Mode safe, pointing to an add-on or theme that is not compatible.

    Start Firefox normally, and then disable any topic and the modules one by one until you find the culprit - Manager of modules additional (Ctrl + Shift + A) > appearance/Extensions. You may need to restart Firefox after you disable some of them.

    More: Troubleshooting extensions, themes and problems of hardware acceleration to resolve common Firefox problems.

    If your question is resolved by this or another answer, please take a minute to let us know. Thank you!

  • Difference between synchronous and asynchronous service (Process BPMN).

    When we create new BPM process jdeveloper gives 4 options including easy and synchronous service.

    I want to know how they differ logically because the two models look same!

    In an asynchronous process, the starting node is exposed as a "unique sense", so if you see the wsdl for this (port type section), you will see only the entries and no results. This means that the appellant is not expected that the process at the end. In a synchronization process, the web service to the starting node interface is "track two", request/response...so you will see both and input and output in the section type of port. the appellant awaits the response of the process.

  • SQLite busy cursor

    Hello!

    Is it possible to have the showBusyProperty for synchronous SQLite connections and operations?

    Thank you!

    If you want to display a busy cursor just add

     CursorManager.setBusyCursor();
    

    Just after you start working with SQLite, and once you are removing.

    CursorManager.removeBusyCursor();
    
  • How can I create a user account: username and password?

    I'm trying to transfer bookmarks Firefox from one machine to the other. I need an account to identify bookmarks I want, but as far as I know, I do not have an account of Firefox. So I try to create one on the old machine that I use to transfer bookmarks to the new machine.

    You can copy files in the profile folder of Firefox on a computer in the folder of the profile on another computer by copying the files on a removable USB (USB key).

    You can copy files like these in the Firefox profile folder to retrieve specific data.

    • bookmarks and history: places.sqlite
    • favorite backup: backups JSON in the bookmarkbackups folder
    • SQLite files cookies.sqlite (cookies) and formhistory.sqlite (saved form data)
    • logins. JSON and signons3.txt (decryption key) of the saved passwords in password manager
    • cert8. DB for stored intermediate certificates (Certificate Manager)
    • Persdict.dat for the words that you added to the spelling dictionary
    • Permissions.SQLite and, possibly, content - prefs.sqlite permissions and Site preferences
    • sessionstore.js to open and pinned tabs and tab groups

    You can retrieve more personal data.

    See also:

    For synchronization, see:

Maybe you are looking for

  • Turning off camera flash iphone7

    How to disable the flash of the camera on the iphone7

  • Firefox Password Manager don't ask if it should save passwords - RESOLVED

    I used both Keefox and Secure Login at the same time. Probably the wrong thing to do, but they don't seem to be in conflict. However, I have no doubt eventually will go with only Secure Login (in collaboration with the FF password manager). For the m

  • Upgrading RAM on toshiba satellite pro l650

    I have 2 toshiba satellite pro l650. first of all an i did a RAM upgrade 8 GB (2 x 4 GB DDR3 1066 MHz Kingston) 1 year ago and work. Now, I would like to upgrade to the other laptop. I bought 'Impact HyperX HX316LS9IBK2/8 2 x 4 GB 1600 MHz CL9 SODIMM

  • How can satellite A60-124 - I extract BIOS or reset?

    Hello I am looking for the solution to extract the BIOS on Satellite A60 (PSA60E 09T060FR) or a procedure to reset the chip.Here is the "software model inside of the bios-m I 2238 Thank you very much

  • Upgrade memory for MBP 12.1 13 "

    Hi all Anyone have any recommendations as to where I can get the right type of SSD to upgrade my MBP 2015 - just bought second hand and will probably need more of its 128 gb but couldn't refuse the offer! I noticed there are other options is Airdrive