#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Unhappy Problems with threads


    Hello everyone. Can you help me with creating threads and constructor. Here's what I need:

    Code:
    var a,b:array [1..15] of integer; i:integer;
    
    for i:=1 to 5 do
    b[i]:=sqr(a[i]);
    
    for i:=6 to 10 do
    b[i]:=a[i]+8;
    
    for i:=10 to 15 do
    b[i]:=a[i]-10;
    Can any kind soul show me how can I split this serial process in three parallel parts using threads and constructor.

    I need 3 threads, where each thread takes needed a[i] (from the main program) for its part, finds b[i] and gives it back to the main program where I can work with ready b[i]. It's just a simple example so can anyone show me how to create threads. No theory just code.

    Please and thank you in advance
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    2
    You may want to check this article:
    http://forum.codecall.net/topic/70827-very-simple-multithreading/

IMN logo majestic logo threadwatch logo seochat tools logo