| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | threads, threads, more threads |
jl> I have a question about using more than two threads in jl> a PM application. I create an object window which jl> handles messages sent to threads (different parts of jl> my program want to do things simultaneously, e.g. read jl> one file and display other). I use the /same/ thread jl> function for all threads. jl> Is this OK to do? Are there any situations in which my jl> program would behave erroneusly? I just briefly looked at your code and didn't see any glaring errors in a few-second browse, but thought that you might find these guidelines helpful: 1) Multithread programs should minimize the use of static and global variables. 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. It is not a problem to use the same function for running multiple threads as long as you follow the above guidelines. --- Maximus/2 2.01wb* Origin: OS/2 Connection {at} Mira Mesa, CA (1:202/354) 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 712/353 623 713/888 800/1 @PATH: 202/354 301 1 3615/50 229/2 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™.