Cross-platform: Coloured text, Networking, Multithreading

  • Thread starter Tomás Ó hÉilidhe
  • Start date
T

Tomás Ó hÉilidhe

I'm currently writing a program and I've got in mind to keep it as
portable as possible. In particular I want it to run on Linux and
Windows, but I'm also keeping an open mind to any machine that has a
screen and is capable of Ethernet networking. The program requires
three things that aren't available in the C Standard:
1) Coloured text (for a console application)
2) Raw socket networking
3) Multithreading

For number 1, I've already written my own tiny little cross-platform
library (it uses ANSI escape sequences for Linux, and Win32 API
functions for Windows).

For number 2, I've again written my own tiny little cross-platform
library (it uses Berkeley Sockets for Linux, and winpcap for Windows
-- I would have used Winsock for Windows but Winsock no longer
supports raw sockets).

For number 3, well I'm just about to delve into it now. I see that
somebody has already ported the "pthreads" library to Win32, so that
looks like a very attractive option. Just before I go down that road
though, I'd like to ask if anyone has a better idea than to use
pthreads?
 
V

vippstar

I'm currently writing a program and I've got in mind to keep it as
portable as possible. In particular I want it to run on Linux and
Windows, but I'm also keeping an open mind to any machine that has a
screen and is capable of Ethernet networking. The program requires
three things that aren't available in the C Standard:
1) Coloured text (for a console application)
2) Raw socket networking
3) Multithreading

For number 1, I've already written my own tiny little cross-platform
library (it uses ANSI escape sequences for Linux, and Win32 API
functions for Windows).

How cute. Why do we need to know all this?
For number 2, I've again written my own tiny little cross-platform
library (it uses Berkeley Sockets for Linux, and winpcap for Windows
-- I would have used Winsock for Windows but Winsock no longer
supports raw sockets).

How cute. Why do we need to know all this?
For number 3, well I'm just about to delve into it now. I see that
somebody has already ported the "pthreads" library to Win32, so that
looks like a very attractive option. Just before I go down that road
though, I'd like to ask if anyone has a better idea than to use
pthreads?

So you're asking about threading, concurrency, and thread libraries in
comp.lang.c. You're going to have to try harder if you expect to troll
someone. (hint: try an unrelated rant about gypsies in your post)
 
T

Tomás Ó hÉilidhe

Perhaps you could ask in comp.programming.threads, where the
threading experts hang out?


Your sarcasm is a little addictive but I'll try to resist. I asked the
question on comp.lang.c because I'm writing a program in C.

I could imagine, if I asked the question over on c.p.t, that they'd
direct me here.
 
T

Tomás Ó hÉilidhe

How cute. Why do we need to know all this?


Because your head is vacuous and I wanted to offer you a filler.

So you're asking about threading, concurrency, and thread libraries in
comp.lang.c.


Which thread have you been reading? Nope, never mentioned anything
about concurrency; that was your own mental masturbation taking over
to throw in a buzz word to show the big kids that you actually have a
clue what you're talking about.

I'm writing a program in C and I'm asking for advice on what threading
library to use in C. If you don't have the answer, please don't do a
dance to distract is from your lack of knowledge.
 
K

Kenny McCormack

Eric Sosman said:
No, never mind, that's too obvious, where's the adventure in
getting useful answers from experts when you could instead get a
boatload of nonsense from non-experts? Much more entertaining to
do it your way, I suppose.

Thank you for confirming everything I (and other truth tellers, er, I
mean, trolls) have been saying about CLC for years.

(That this newsgroup is populated by a bunch of nattering fools.)
 
K

Kenny McCormack

How cute. Why do we need to know all this?
[/QUOTE]

Typical clc jabber. Note that vippy is our latest reg wannabee, so he
tries extra hard.
Because your head is vacuous and I wanted to offer you a filler.

Yup - you got his number.
Which thread have you been reading? Nope, never mentioned anything
about concurrency; that was your own mental masturbation taking over
to throw in a buzz word to show the big kids that you actually have a
clue what you're talking about.

I'm writing a program in C and I'm asking for advice on what threading
library to use in C. If you don't have the answer, please don't do a
dance to distract is from your lack of knowledge.

You will soon learn that this newsgroup is about everything except C.
 
K

Kenny McCormack

So split it. comp.lang.c and comp.lang.iso-c :)

Exactly.

As I've pointed out many times in the past, the (real, core) problem is
simply that this group is misnamed. If it were named something like
comp.lang.obscurely_academic.iso-only.andNothingElse, then the
discussions occurring here would be entirely correct and justified.

Or, to put it another way, the people who should have gone out and
created (new-grouped) c.l.o.i.a decided instead to invade and take over
this group. And things haven't been the same since.
 
A

Antoninus Twink

Perhaps you could ask in comp.programming.threads, where the
threading experts hang out?

Oh come on, Eric - it hardly takes a world expert on threading to be
able to say that pthreads is an excellent choice, and if it's available
on all the target platforms then go for it.
 
M

Martin Ambuhl

Tomás Ó hÉilidhe said:
Your sarcasm is a little addictive but I'll try to resist. I asked the
question on comp.lang.c because I'm writing a program in C.

There is _no_ sarcasm in the suggestion that when using features that
are not standard C but which have supporting newsgroups that you not ask
in a newsgroup for C (where those features are not topical) but in a
newsgroup specifically for those features (where those features are
obviously topical).

When you write programs using threads, something not supported by C but
by specific implementations on specific platforms, you are outside the
realm of writing programs in C.
I could imagine, if I asked the question over on c.p.t, that they'd
direct me here.

Then they have no idea of what either C or threads are. I can't believe
that the folks in cpt are that clueless. But if your post is any
indication, ...
 
M

Martin Ambuhl

Tomás Ó hÉilidhe said:
On Nov 12, 11:39 pm, (e-mail address removed) wrote:
Because your head is vacuous and I wanted to offer you a filler.

I suppose you think that is clever. It only marks you as at least one
of an idiot or a boor. You haven't yet made it to my killfile, but keep
it up and you will. I suspect that several people who could have been
useful to you when you have a legitimate C question will have already
sent you to their bozo bins.
 
K

Kenny McCormack

I suppose you think that is clever. It only marks you as at least one
of an idiot or a boor. You haven't yet made it to my killfile, but keep
it up and you will. I suspect that several people who could have been
useful to you when you have a legitimate C question will have already
sent you to their bozo bins.

IOW, welcome to CLC. We hope you enjoy your stay.
 
D

Default User

Martin said:
I suppose you think that is clever. It only marks you as at least
one of an idiot or a boor. You haven't yet made it to my killfile,
but keep it up and you will.

He made mine a long time ago. He started this same crap on
comp.lang.c++ back when. He even tried to start a cross-platform C++
newsgroup, but I don't think it went anywhere.

At any rate, he knows all about topicality rules. He's another that
doesn't like them, so he chooses to behave like an ass.




Brian
 
J

jameskuyper

Tomás Ó hÉilidhe said:
Your sarcasm is a little addictive but I'll try to resist. I asked the
question on comp.lang.c because I'm writing a program in C.

So, by the same logic, if you were writing a program that accumulated
football statistics, you'd feel that the fact that it was written in C
was sufficiently good reason to post questions here about football
arcana relevant to your program?

Yes, I'm being sarcastic; but I'm also curious about how you reached
such a bizarre conclusion.
 
W

William Hughes

Oh come on, Eric - it hardly takes a world expert on threading to be
able to say that pthreads is an excellent choice, and if it's available
on all the target platforms then go for it.

Perhaps not. But it would certainly take an expert on threading to
know
that the underlying Windows model does not adapt well to the pthread
model
thus leading to some subtle bugs when using thread based mutexes.
I remember being burned by this a few years back. I have no idea if
it is still a problem. This is the problem with non-expert advice,
not only are the non-experts ignorant of something, they may well
think
that they are not (The bug was subtle and didn't hit at first.
Before
that my advice would have been, "Use pthreads, I have successfully
used
these when I needed Linux/Windows compatibility").

- William Hughes
 
C

Chris M. Thomasson

Perhaps not. But it would certainly take an expert on threading to
know
that the underlying Windows model does not adapt well to the pthread
model
thus leading to some subtle bugs when using thread based mutexes.
I remember being burned by this a few years back. I have no idea if
it is still a problem. This is the problem with non-expert advice,
not only are the non-experts ignorant of something, they may well
think
that they are not (The bug was subtle and didn't hit at first.
Before
that my advice would have been, "Use pthreads, I have successfully
used
these when I needed Linux/Windows compatibility").

There are several options wrt porting some PThread applications over to
Windows:

http://technet.microsoft.com/en-us/interopmigration/bb380242.aspx

http://sourceware.org/pthreads-win32

http://www.cygwin.com
 
C

Chris McDonald

Richard Heathfield said:
comp.lang.c already serves the purpose that you appear to have in mind for
comp.lang.iso-c, making that suggestion redundant.


(not trolling) but the suggestion is *not* redundant.

It comes with the suggestion that the name comp.lang.iso-c would provide a
clearer label for those ill-informed about the current use of comp.lang.c
 
B

Bartc

Yes. He hit my killfile some months ago, for racism, of all things.

I find it surprising that so many people who witnessed that discussion and
should therefore be aware of his racist attitude continue to enter into
further technical discussions with him despite the absence of any apology
or retraction on his behalf. (But then I find many things surprising.)

Well, some people are more tolerant than others.

Richard Heathfield said:
Lorenzo Villari said:
comp.lang.c already serves the purpose that you appear to have in mind for
comp.lang.iso-c, making that suggestion redundant.

There is already c.l.c.moderated, which could serve the purpose of the
..iso-c suggestion.

I don't have a problem with c.l.c being wider-ranging, especially as it's
not very active at the minute.
 
J

James Kuyper

Bartc wrote:
....
....
There is already c.l.c.moderated, which could serve the purpose of the
.iso-c suggestion.

Have you tried it? It can take weeks for a message to get through the
c.l.c.moderated moderation queue. If someone had the spare time to take
over moderation of that group and put more time into it than the current
moderator does, it might be a reasonable alternative, but it isn't as
things currently stand.
Note: I'm not criticizing the current moderator: I have no idea how much
of his time is required to keep the spam and other junk out of the
newsgroup, but it's probably more time than I could afford to spend on
that task.
I don't have a problem with c.l.c being wider-ranging, especially as
it's not very active at the minute.

It's more than sufficiently active from my point of view. It currently
receives more postings per day than I can easily keep pace with without
interfering with the rest of my life. It takes up that much time despite
the fact that I'm trying to ignore all postings from a small set of
known trolls, and any thread started by Bill Cunningham.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,040
Latest member
papereejit

Latest Threads

Top