473,396 Members | 1,779 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

callback or threading or something else ?


bool foundOrNot = 0;
while (! foundOrNot){
// from here do some calculations here
......
......
// till here

foundOrNot = doSomeWastingTimeThing(); // This function will spend
a lot of time to get the answer of returnValue
// do some other calculations here, for example
......
......
......
// till here
}
Since we know that doSomewastingTimeThing( ) will spend us a lot of
time.
We want to do the other things till doSomeWastingTimeThing get the
return value (foundOrNot).
When doSomeWastingTimeThing return the answer, we begin to do something
about the returned answer.

Now, my question is:
1. How can I do it in C Language? Could you show me some valid code?
My friend told me that I may use a call back function or thread to
achieve it. But he never did that before.
Could someone guide me to the right direction or give me some url or
examples?
Thanks in advance.

-jiing-

Nov 14 '05 #1
1 1102
"jiing" <ji********@gmail.com> wrote:
Since we know that doSomewastingTimeThing( ) will spend us a lot of
time.
We want to do the other things till doSomeWastingTimeThing get the
return value (foundOrNot).
When doSomeWastingTimeThing return the answer, we begin to do something
about the returned answer.

Now, my question is:
1. How can I do it in C Language?


You can't; not in C alone. If you are on a Unixoid, or somewhere else
where POSIX-like threads are available, perhaps comp.unix.programmer can
give you an answer; if not, your system does probably provide threading,
but as an extension to ISO C, and you'll need to ask in a newsgroup that
discusses programming for your compiler and/or OS.

Richard
Nov 14 '05 #2

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

Similar topics

5
by: Francois De Serres | last post by:
Hiho, could somebody please enlighten me about the mechanics of C callbacks to Python? My domain is more specifically callbacks from the win32 API, but I'm not sure that's where the problem...
1
by: Mohamed Fysal | last post by:
I have written a Regular DLL with many Export Functions and one CALLBACK fun ction . The callback function declared in the .cpp file of the Regular DLL is as fol lows: typedef BOOL...
3
by: David | last post by:
Hi, Ive been trying to work this out for the past 2 days now and im not getting anywhere fast. The problem i have is that i am using Asynchronous sockets to create a Socket Client library....
4
by: Zach | last post by:
(1.) What is the general meaning of the term 'callback'? (2.) What does 'callback' mean, as used in the context of threading? Many thanks, Zach.
2
by: Marten Van Keer | last post by:
Hi; I have two applications A and B *** Application B listens on a network stream with a callback function:
5
by: greg.merideth | last post by:
I have a class that I've provided an event for to be called when the processing in the class is complete (a callback). The class spins up a series of threads for the background operation and I'm...
11
by: The Frog | last post by:
Hi all, Maybe I am just missing something simple here, but I seem to have an issue with a callback function in A97 that is used to fill a Listbox with values. The first time the callback...
2
by: billsahiker | last post by:
I wrote a test program to help understand asynchronous calls in c#. I have a working VB.NET app that uses a similar technique but I cannot get it to work in c#. The errors I get and the code below....
4
by: Curious | last post by:
Hi, I have a timer object that's launched as below: mTimer = new System.Threading.Timer (new TimerCallBack(SubscribeTrade), null, 15000, 15000); void SubscribeTrade (object state) {...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.