# serialEvent(Serial port) realtime

**URL:** https://discourse.processing.org/t/serialevent-serial-port-realtime/15485
**Category:** Electronics (Arduino, etc.)
**Created:** [November 14, 2019, 12:40pm UTC](https://discourse.processing.org/t/serialevent-serial-port-realtime/15485 "2019-11-14T12:40:54Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![kb12592](https://avatars.discourse-cdn.com/v4/letter/k/ba8739/32.png) [@kb12592](https://discourse.processing.org/u/kb12592)
#### Post date: [November 14, 2019, 12:40pm UTC](https://discourse.processing.org/t/serialevent-serial-port-realtime/15485/1 "2019-11-14T12:40:54Z")

</div>

Hi all,

I was wondering if anyone could tell me how void serialEvent function works - I know it is called when data is available from the serial port - but does it wait until it has run through the whole function before being called again, or does it run in parallel if there is another data point is available and it hasn’t finished processing the previous data point?

Also can saving data to a .txt file each time within this loop slow down the acquisition/process and saving of data via this functon?

---

<div class="post-metadata">

### Author: ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)
#### Post date: [November 14, 2019, 4:35pm UTC](https://discourse.processing.org/t/serialevent-serial-port-realtime/15485/2 "2019-11-14T16:35:12Z")

</div>

> [@kb12592](#):
>
> - but does it wait until it has run through the whole function before being called again,

- Callback **serialEvent()** is invoked by a Serial instance’s own Thread. 🧵
- The same Thread won’t invoke next **serialEvent()** while it hadn’t finished the current 1.
