Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

threading a stack

Status
Not open for further replies.

carbonate

IS-IT--Management
Sep 25, 2004
1
FR
Hi,

I want to implement a thread stack in my program, but I don't know how to do this.

Here is what the precise description of the problem :

I have a class (called "Orders" for example) which contains two variables :

* a fixed array of "orders"
* a fixed array of result of orders

My class offers the "push_order" method, which add an order to my stack, and the "delete_orders", which delete an order from the stack. The treatment of each order may be less or more longer.

My "Orders" class is a member variable of another class, so I can put new order to my Orders class with the push_order function.

----

class Orders
char *order[255]
char *result[255]

push_order(char *order)
delete_order(int index)
...
----

class Toto
Orders test = new ...
...
----

I want that my class Orders treats the orders regularly, independantly, and change the results array consequently.
And I want that my class Toto checks regularly if there any new result in my stack, in order to do another treatment.

I don't know how can I do it. Can I use two CreateThread, one in the class Toto for checking the results in my Orders class, and another in my Orders class to treat regularly the new orders ? Can you draw me the best skeleton of program I should do ?

Thank you for your help, and excuse me for my bad english.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top