delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/28/07:15:52

X-Originating-Host: 202.137.2.145
Organization: http://www.remarq.com: The World's Usenet/Discussions Start Here
Subject: Re: multitasking/threading in DJGPP
Lines: 33
From: batchex <thedark1NOthSPAM AT phreaker DOT net DOT invalid>
Newsgroups: comp.os.msdos.djgpp
Message-ID: <07e97600.58b5dac5@usw-ex0101-005.remarq.com>
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000619173815 DOT 27216T-100000 AT is> <394F7CEF DOT C3B04F13 AT crosswinds DOT net> <200006202002 DOT XAA00101 AT alpha DOT netvision DOT net DOT il> <3951E3E6 DOT 34B80384 AT crosswinds DOT net>
Bytes: 1202
X-Wren-Trace: eCcCKisydT90czsqJmY0JWQUJyowJmY6JzlmKisnfjV4cyl3ejB8e2V3d3c=
Date: Mon, 26 Jun 2000 13:32:24 -0700
NNTP-Posting-Host: 10.0.2.5
X-Complaints-To: wrenabuse AT remarq DOT com
X-Trace: WReNphoon4 962051682 10.0.2.5 (Mon, 26 Jun 2000 13:34:42 PDT)
NNTP-Posting-Date: Mon, 26 Jun 2000 13:34:42 PDT
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

I am now thinking on how to destroy a thread when it finished
it's job. My original idea is to write a multithreaded lib to
support more than one functions to execute concurrently. I have
no intentions, at least not now, to support different programs
to execute concurrently.

The idea is to call a spawn_thread() function to setup a new
thread, which is actually another function running in paralel
with the main program. What I'm confused with when that function
returns, how can I detect this and how to clean up the mess.

One way to do this IMO is by using a job_done flag and end_thread
() function which have a pseudo-code like this :

1. set this thread's job_done flag to true
2. enter an infinite loop

end_thread() is called at the end of a thread function. It's the
scheduler job to check the job_done flag for every thread and if
it finds a thread with a true flag, then do the necessary
cleanup.

Plz tell me what you think. BTW, my questions regarding a
comprehensive signals guide and how to determine the source of a
signal still stands.

Thanks

Got questions?  Get answers over the phone at Keen.com.
Up to 100 minutes free!
http://www.keen.com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019