The problem here is all about timing, so let's all get our oscilloscopes out! Basically (and a little over simplified) most standard C flow control statements cannot make timing guarantees on a microcontroller. Hardware based interrupts guarantee the code will begin execution within a fixed number of clock cycles.
The Arduino (more specifically, the Arduino Uno with a ATmega328) has lots of ways to trigger hardware interrupts, called "interrupt vectors" sometimes (pg 57 of the ATmega Datasheet). Which one do we want? We want to execute code immediately after the cock pin transition, so we are looking for a Pin Change Interrupt or an external interrupt. Section 12 in the datasheet goes into way too much detail on this, but the key thing is each port of 8 pins shares an interrupt vector! ( arduino.cc/en/Hacking/PinMapping168 ) This makes it tricky, especially if you are new to microcontrollers. The Arduino community created a great library for just such a situation, called PinChangeInt. (Disclaimer: I contributed to PinChangeInt)
The builtin Arduino interrupt creator function (attachInterrupt(interrupt, ISR, mode)) and PinChangeInt's interrupt creator (PCintPort::attachInterrupt(PIN1, &ISRfunc, EDGE)) take very similar arguments. The pin and edge/mode arguments are self explanatory - The pin you want the interrupt on and the edge you are interested (most likely rising, but check the timing diagram for your clock). The function name you specify is attached as the Interrupt Service Routine (ISR). Whenever the hardware sees that interrupt, the ISR begins executing. This function (ISRfunct() above) takes no arguments and returns no values (type VOID). It can access global and other in scope variables like any function. To implement the logic you are describing you will need a global variable for your data, and one for the "index of transmission," or the last bit sent.
For more background on interrupts on the Arduino check out the links below:
ATmega168 Subsystem Diagrams
uchobby.com/index.php/2007/11/24/arduino-interrupts/
gonium.net/md/2006/12/20/handling-external-interrupts-with-arduino/