473,765 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cross-platform: Coloured text, Networking, Multithreading


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?
Nov 12 '08
42 2640
Tomás Ó hÉilidhe wrote:
On Nov 12, 11:39 pm, vipps...@gmail. com wrote:
>How cute. Why do we need to know all this?
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.
Nov 12 '08 #11
In article <gf**********@n ews.eternal-september.org>,
Martin "Mr. Compassion" Ambuhl <ma*****@earthl ink.netwrote:
>Tomás Ó hÉilidhe wrote:
>On Nov 12, 11:39 pm, vipps...@gmail. com wrote:
>>How cute. Why do we need to know all this?
>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.
IOW, welcome to CLC. We hope you enjoy your stay.

Nov 12 '08 #12
Tomás Ó hÉilidhe wrote:
On Nov 12, 11:27�pm, Eric Sosman <Eric.Sos...@su n.comwrote:
Perhaps you could ask in comp.programmin g.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.
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.

Nov 12 '08 #13
On Nov 12, 1:54 pm, Antoninus Twink <nos...@nospam. invalidwrote:
On 12 Nov 2008 at 16:27, Eric Sosman wrote:
Tomás Ó hÉilidhe wrote:
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?
Perhaps you could ask in comp.programmin g.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.
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

Nov 12 '08 #14
William Hughes wrote:
On Nov 12, 1:54 pm, Antoninus Twink <nos...@nospam. invalidwrote:
>On 12 Nov 2008 at 16:27, Eric Sosman wrote:
>>Tomás Ó hÉilidhe wrote:
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?
Perhaps you could ask in comp.programmin g.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.

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") .
Exactly. What Twink has demonstrated is that it hardly takes
an expert to spout nonsense, but that it may take an expert to
spot it.

No matter what forum Tomás selects for his questions on threads
(or on any other topic), he will probably get answers that are a
mixture of sense and nonsense. On a forum where experts hang out
the nonsense will be rebutted; on a forum where the experts are
scarce it may go unchallenged.

--
Er*********@sun .com
Nov 12 '08 #15

"William Hughes" <wp*******@hotm ail.comwrote in message
news:97******** *************** ***********@r36 g2000prf.google groups.com...
On Nov 12, 1:54 pm, Antoninus Twink <nos...@nospam. invalidwrote:
On 12 Nov 2008 at 16:27, Eric Sosman wrote:
Tomás Ó hÉilidhe wrote:
>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?
Perhaps you could ask in comp.programmin g.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.
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/i.../bb380242.aspx

http://sourceware.org/pthreads-win32

http://www.cygwin.com

Nov 12 '08 #16
"Chris M. Thomasson" <no@spam.invali dwrites:
"William Hughes" <wp*******@hotm ail.comwrote in message
news:97******** *************** ***********@r36 g2000prf.google groups.com...
[...]
>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/i.../bb380242.aspx

http://sourceware.org/pthreads-win32

http://www.cygwin.com
That may be true, but it doesn't address the concerns raised by
William Hughes. Once again, the folks in comp.programmin g.threads are
likely to know a lot more about this than we are.

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Nov 12 '08 #17
Lorenzo Villari said:
>
"Kenny McCormack" <ga*****@shell. xmission.comha scritto nel messaggio
news:gf******** *@news.xmission .com...
>>
You will soon learn that this newsgroup is about everything except C.

So split it. comp.lang.c and comp.lang.iso-c :)
Note that Mr McCormack is either lying, incorrect, or making a not very
successful foray into the world of sarcasm.

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

For discussing things that aren't ISO C, we already have over 80,000
newsgroups. Why would we need yet another?

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 13 '08 #18
Martin Ambuhl said:
Tomás Ó hÉilidhe wrote:
>On Nov 12, 11:39 pm, vipps...@gmail. com wrote:
>>How cute. Why do we need to know all this?
>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.
Possibly both.
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.
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.)

--
Richard Heathfield <http://www.cpax.org.uk >
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
Nov 13 '08 #19
Richard Heathfield wrote:
(But then I find many things surprising.)
When you stop, worry.

--
Ian Collins
Nov 13 '08 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2054
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
12
3879
by: * ProteanThread * | last post by:
but depends upon the clique: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=954drf%24oca%241%40agate.berkeley.edu&rnum=2&prev=/groups%3Fq%3D%2522cross%2Bposting%2Bversus%2Bmulti%2Bposting%2522%26ie%3DUTF-8%26oe%3DUTF-8%26hl%3Den ...
0
1893
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
4
5584
by: David Peach | last post by:
Hello, hope somebody here can help me... I have a query that lists defects recorded in a user defined date range. That query is then used as the source for a Cross Tab query that cross-tabs count of defect type by calendar month. Defect types are stored in one table, defect transactions in another along with date etc. When I cross-tab the results, defect types that have no defects recorded against them appear as a blank (null) value. That...
23
6543
by: Jeff Rodriguez | last post by:
Here's what I want do: Have a main daemon which starts up several threads in a Boss-Queue structure. From those threads, I want them all to sit and watch a queue. Once an entry goes into the queue, grab it and run a system command. Now I want to make sure that system command doesn't hang forever, so I need some way to kill the command and have the worker thread go back to work waiting for another queue entry.
0
2059
by: Web Science | last post by:
Site and Features: http://www.eigensearch.com Search engine, eigenMethod, eigenvector, mathematical, manifolds, science, technical, search tools, eigenmath, Jacobian, quantum, mechanics, manifolds, science, physics, chemistry, law, legal, government, home, office, business, domain lookup, medical, travel, food, university students, searching, searchers, surfing, advanced search, search tools Chemistry, mathematics, physical sciences,...
1
2765
by: Rob Woodworth | last post by:
Hi, I'm having serious problems getting my report to work. I need to generate a timesheet report which will contain info for one employee between certain dates (one week's worth of dates). I have a table containing records for each job done, the records contain date, employee name, job done (a code representing the type of job), cost code (another code), regular hours, and overtime hours. The tricky part is that more than one job can...
6
8635
by: Simon | last post by:
Hi All, An experiment i'm doing requires requires a synchronous cross-domain request, without using a proxy. I wondered if anyone had any ideas to help me achieve this. Below is what I have tried, including my conclusions/assumptions (which i'll happily be corrected on if it solves my problem!): The requirement not to use a proxy means I can't use the synchronous
6
5482
by: Bart Van der Donck | last post by:
Hello, I'm presenting my new library 'AJAX Cross Domain' - a javascript extension that allows to perform cross-domain AJAX requests. http://www.ajax-cross-domain.com/ Any comments or suggestions are welcome. --
6
3991
by: ampo | last post by:
Hello. Can anyone help with cross-domain problem? I have HTML page from server1 that send xmlHTTPRequest to server2. How can I do it? Thanks.
0
9398
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10160
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9951
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8831
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5275
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3531
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2805
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.