473,379 Members | 1,312 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,379 software developers and data experts.

What is synchronous and asynchronous function?

8
What is synchronous function?
What is asynchronous function?

Unsigned char a=0;
Void function (void ){
Unsigned char Flag;
Flag=0
If (a==1){
Flag=1;
}
Return (Flag)
}

EI()__external interrupt
{
a=1;
}
Can you please let me know above function is synchronous or asynchronous?
Aug 18 '09 #1
4 25868
Dheeraj Joshi
1,123 Expert 1GB
Hi.

Synchronous method call wait for the method to complete before continuing with program,asynchronous method call will return immediately and program can perform other operations. Called method will work independently.


Regards
Dheeraj Joshi
Aug 18 '09 #2
JosAH
11,448 Expert 8TB
@kp7796
This isn't even valid C; please post readable questions, don't just dump ill formatted snippets here and expect your readers to be psychic. Read about code tags and how to use them and proofread your own question before you post it.

kind regards,

Jos (moderator)
Aug 18 '09 #3
Banfa
9,065 Expert Mod 8TB
There is no such thing as a synchronous or asynchronous function. All functions are called execute and finish.

There are asynchronous operations, that is operations that you call a function to start but where the start function returns immediately and the operation makes some sort of callback to your code when it completes to give its completion status.

What you appear to have there is a normal function and an interrupt routine. I have heard interrupt routines refered to as many things, notably both foreground and background processing. None of these terminologies are standard. What is important is that you understand how an interrupt routine works and what restrictions it places on the program as a whole.

Any processor has interrupts, that is external inputs that can fire at any time during processing. When an enabled interrupt fires during processing what normally happens is the processor stores the current state of processing on the stack and jumps directly to a special routine (function), the interrupt handler which it executes. When that function finishes the processor restores the processing state from the stack and continues.

Interrupt routines are typically short so that they run quickly because they often have to respond directly to hardware events.

The effect on your programming is that you have to make sure that any functions you wish to call from your interrupt routine are written so that they can be called from an interrupt routine. Sometimes this means giving them special prototypes and in such cases it is not unheard of to have 2 versions of the same function, 1 to call from normal processing and 1 to call from interrupt routines.

However more importantly it is normal for interrupt routines to alter data to indicate the interrupt happened in some way. It is very important that this data is protected from dual access, that is the program trying to read it while the interrupt routine writes it or worst still the program trying to write it while the interrupt routine writes.

In the first case you may get strange control decisions in the second case you may corrupt program data.
Aug 18 '09 #4
donbock
2,426 Expert 2GB
In what context did you hear the terms synchronous function and asynchronous function?
Aug 18 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Chris | last post by:
Hi. I have a ibrary I'm trying to use via javascript within IE. This library uses an asynchronous model where I call into a function and pass it a callback function as one of its arguments. My...
9
by: David | last post by:
Hello I'm testing the XMLHttpRequest object in Firefox and IE. The code below works well in IE and Firefox. It shows "1" when the string is a number and "0" when not. The page aspxTest.aspx only...
13
by: ALI-R | last post by:
Hi All, When we say events are processed asynchronously in for instance Sharepoint ,what dose it mean? Thanks for your help. Ali
3
by: Pro1712 | last post by:
Hi, this may be a stupid question: How can I can call the DoWork-function of a BackgroundWorker synchronous? Or in other words: How can I extend the BackgroundWorker class with a function...
4
by: Ryan Liu | last post by:
TcpClient has a method called GetworkStream GetStream(); So in other words, there is only one stream associate with it for input and output, right? So while it is receiving, it can not send, and...
0
ammoos
by: ammoos | last post by:
hi friends pls help me.. i got an assignment which i feel very difficult to me.. i dont have more knowledge about multi-threading in .net... the assignment details is below.... pls help me... i...
3
by: ppuniversal | last post by:
Hi everyone, I am making using Shell() function to run a command line tool from my VB Application. I am using it to archive a folder. So I am using the code : Shell("command line argument as...
14
by: Mohamed Mansour | last post by:
Hey there, this will be somewhat a long post, but any response is appreciated! I have done many PInvoke in the past from C++ to C#, but I did PInvoke within C# not C++/CLI. Can someone explain...
7
by: Trastabuga | last post by:
I have a simple task: I need to change image src on the fly and then get its new width and height; var url = "/some/request"; var img = document.getElementById('my_img'); var old_width =...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.