ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2011/12/27/21:15:15

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
From: jimm <jmichae3 AT yahoo DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: pthreads compilation error
Date: Tue, 27 Dec 2011 17:55:07 -0800 (PST)
Organization: http://groups.google.com
Lines: 119
Message-ID: <61c5267e-a10f-48ef-9db0-c667c4d48474@n13g2000prf.googlegroups.com>
References: <032816da-42c9-45e7-87f2-516da6fd7455 AT q8g2000yqa DOT googlegroups DOT com> <ec7c6ee3-d02d-4fa2-b379-ff9781164f58 AT q9g2000yqe DOT googlegroups DOT com>
NNTP-Posting-Host: 24.22.56.37
Mime-Version: 1.0
X-Trace: posting.google.com 1325037308 11437 127.0.0.1 (28 Dec 2011 01:55:08 GMT)
X-Complaints-To: groups-abuse AT google DOT com
NNTP-Posting-Date: Wed, 28 Dec 2011 01:55:08 +0000 (UTC)
Complaints-To: groups-abuse AT google DOT com
Injection-Info: n13g2000prf.googlegroups.com; posting-host=24.22.56.37; posting-account=05hOMwoAAAB6R8xtiQKzEljSMzgOhVF1
User-Agent: G2/1.0
X-Google-Web-Client: true
X-Google-Header-Order: HUALESNKRC
X-HTTP-UserAgent: Mozilla/5.0 (Windows NT 5.1; rv:9.0.1) Gecko/20100101 Firefox/9.0.1,gzip(gfe)
Bytes: 6244
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id pBS2F2Li005649
Reply-To: djgpp AT delorie DOT com

> > Wextra -v -save-temps -s -Map=pthreads.map -oa.exe pthreads.cpp
>
> Isn't GNU ld.exe a bit picky about link order? You may want to keep -
> lpth to the end, though that probably won't solve your problem here.

I thought -lpth as a switch should be before the files to be included
in compilation since it is a switch.  I thought that if it was at the
end it would be interpreted as a filename.

>
> BTW, last I checked, -W is the same as -Wextra, just older / obsolete.
> And a.exe is already default (along with a.out), so I don't see why
> you'd want to specify that (unless you only wanted a.exe and nothing
> else).
>

thanks.

> > In file included from pthreads.cpp:1:0:
> > c:/djc462~1/include/pthread.h:113:53: fatal error: sys/socket.h: No
> > such file or directory (ENOENT)
> > compilation terminated.
>
> You need libsocket (/current/v2tk/ls080*.zip) or Watt-32. I'm not sure
> the former even fully works (anymore, if ever), so I would suggest
> Watt-32 from http://home.broadpark.no/~gvanem/
>

I don't see how threads and sockets even related. seems totally
unnecessary to include socket stuff.
if I have to compile someone else's library/program, I can't do it.
never works for me, I always get errors I can't fix.

watt-32 doesn't have headers or libraries.  the only thing in the bin
dir is some .cfg files.  it's useless.
lotsa links and no go.  the 32-bit protected mode link for stuff like
watcom (djgpp not mentioned) leads to a german site (which I can't
hardly read, but it appears to be a contact page.
so that goes nowhere.

installed ls80 and all other libraries in DJGPP and gort this:

In file included from pthreads.cpp:1:0:
c:/djc462~1/include/pthread.h:115:53: fatal error: sys/wtime.h: No
such file or directory (ENOENT)

that header is not #included in the source file, so it is somewhere
within pthreads.h

so I guess pthreads are officially dead on djgpp?

by the way, -pthreads switch gives an error in DJGPP and it should
not.


> > Sun 12/25/2011 22:05:23.65|C:\prj\test\djgpp|>
>
> > source code is an example from https://computing.llnl.gov/tutorials/pthreads/#Abstract
>
> Okay, but you're asking for complications which I can't help with. I'm
> don't grok multi-threading, sorry. It's a minefield.

as long as you know a few simple concepts, then you are safe with some
basic threading concepts.
- volatile your shared variables. I usually make them globals
- be extremely careful with shared pointers - nasty. c++11 has new
stuff for handling those
- you can use waitformultipleobjects() in main() to see when the
threads are done if it is handle-or-ID-based, or other similar
construct (whatever is in pthreads), OR you can use a global array of
enum statuses (one element for each thread) and update the status
within the thread at start of thread function and at the end and
initialize the array at the start of the program. in main you use a
while-for loop with a isAllDone flag scanning through the status array
seeing if they ALL are done, and when they are, exit the while loop -
to prevent big CPU usage, Sleep() should be used.
- a thread is a user-defined function which runs independently on its
own time schedule.  you can have lots of them.  optimally, as many as
there are cores.
- global shared results memory: just make sure that each thread has
its own assigned "chunk" of the array.  just like the statuses, this
is one method of preventing collision.each thread has its assigned
section.  this prevents chaos.  your design needs may or may not be
segmentable.

>
>
> Not according to your example above.  ;-)   But anyways, what you're
> using is GNU pth, which has (IIRC) both standard POSIX and its own
> API. Anyways, GNU pth is portable but cooperative only. It's somewhat
> limited (and our port is buggy, IIRC), so caveat emptor.
>
> http://www.gnu.org/software/pth/

thanks, I was looking elsewhere for documentation...  I thought pth
meant pthreads because they couldn't fit it into an 8.3 filename.

>
> You may have better luck trying FSU Pthreads (see p7zip 9.13) and/or
> the examples bundled with the Minix version of FSU (used with
> permission):

you're sure p7zip isn't simply 7-zip?  why is it zipped instead of a
self-extracting exe? :-/  when you have to find unzip to extract an
archiver that's pretty sad...
needs an sfx.bin file for dos for making self-extracting exe's.
maybe I can get 7-zip to come out with an official commandline dos
version by putting in a sourceforge.net feature request.

>
> http://www.ibiblio.org/pub/micro/pc-stuff/freedos/files/util/file/7zi...
>
> http://minix1.woodhull.com/pub/contrib/champoll.txt http://minix1.woodhull.com/pub/contrib/champoll.tar.Z

I am about to try, but I can usually only work with stuff that is
precompiled...  I can't compile unix stuff.
I must be the only software engineer who can't compile unix stuff.

- Raw text -


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