Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Thread Question

Posted on 2001-08-05
1
Medium Priority
?
198 Views
Last Modified: 2010-04-21
I am working on a program, and I need to implement some threads.  It needs to compile under both windows and linux.  Right now I have the windows threads working using CreateThread.  What I'm looking for is a good way to do it under linux, that is compatible with the way it is done in windows.  (Basically all globals are shared and stacks are seperate.)  I looked at fork, and that looked wrong, because there is seperate global areas.  I then looked at __create(), and that looked like it would work, except that I couldn't figure out how/where to allocate and deallocate memory for the stack.  I've heard there is a pthread_create that might work also.  I'll give full points to whoever can post some small sample code that I can get to compile, that creates a few threads, accesses some global and local varibles, then quits correctly.
Thanks
Mithander
0
Comment
Question by:Mithander
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 2

Accepted Solution

by:
curri earned 800 total points
ID: 6354978
This page has an example of 2 threads, accessing a global var through a semaphore.

http://centaurus.cs.umass.edu/~wagner/threads_html/sect4.html

There is a page for linux threads with the library and pointers to several tutorials (including the above :)
http://pauillac.inria.fr/~xleroy/linuxthreads/
0

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question