TIP: Click on subject to list as thread! ANSI
echo: os2prog
to: Craig Swanson
from: jari laaksonen
date: 1994-09-09 17:49:16
subject: threads, threads, more threads

jl>> I have a question about using more than two threads in a PM application.

> 2) Any variables or resources that may have to be accessed by more
>    than one thread at a time MUST be protected by a semaphore
>    or some other mechanism in order to avoid corrupting the data
>    structures a thread context switch occurs such that one thread
>    hasn't finished modifying a data structure and then the next
>    thread starts modifying it while it is in an inconsistent state.

Now I have a dynamically allocated structure and thread functions use a
global pointer to that structure. One thread usually modifies some members
in the global structure, e.g. some counters, while other threads just read
these counters.

I have several examples (from Toolkit, EDMI and EMEA DAP Library) of
multiple threads in a PM program and some of them use semaphores and some
don't. I'm not very familiar with semaphores, yet.

What would be the best way to test my program? Start as many resource
consuming processes as I can on my machine and wait until my program
crashes or are there any specific testing programs (I have Validator from
DevCon) ?

        // Albert

---


* Origin: Albert's Point/2 in Finland, Europe (2:221/360.20)
SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 410 413
SEEN-BY: 711/430 807 808 809 934 942 712/353 623 713/888 800/1
@PATH: 221/360 0 220/841 201/2104 109/347 2 7 3615/50 229/2
@PATH: 12/2442 711/409 54/54 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.